{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "tPsJhsL1RFWi",
    "outputId": "386a5de0-90a2-436f-d123-73704b01ea36"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cloning into 'FinRL-Library'...\n",
      "remote: Enumerating objects: 56, done.\u001b[K\n",
      "remote: Counting objects: 100% (56/56), done.\u001b[K\n",
      "remote: Compressing objects: 100% (46/46), done.\u001b[K\n",
      "remote: Total 2427 (delta 21), reused 33 (delta 10), pack-reused 2371\u001b[K\n",
      "Receiving objects: 100% (2427/2427), 29.13 MiB | 2.08 MiB/s, done.\n",
      "Resolving deltas: 100% (1419/1419), done.\n"
     ]
    }
   ],
   "source": [
    "!git clone https://github.com/AI4Finance-LLC/FinRL-Library.git"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "0PyGiqZ5Ph-A",
    "outputId": "9b32e865-0f71-4337-fb47-e86a9505fdf9"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/hongyangyang/Documents/GitHub/finrl-library/FinRL-Library\n",
      "Requirement already satisfied: numpy in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (1.19.1)\n",
      "Requirement already satisfied: pandas>=1.1.5 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (1.1.5)\n",
      "Requirement already satisfied: stockstats in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (0.3.1)\n",
      "Requirement already satisfied: yfinance in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 5)) (0.1.55)\n",
      "Requirement already satisfied: pyfolio in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 6)) (0.9.2+75.g4b901f6)\n",
      "Requirement already satisfied: matplotlib in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 10)) (3.2.1)\n",
      "Requirement already satisfied: scikit-learn>=0.21.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 13)) (0.21.0)\n",
      "Requirement already satisfied: gym>=0.17 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 14)) (0.18.0)\n",
      "Requirement already satisfied: stable-baselines3[extra] in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 15)) (0.10.0)\n",
      "Requirement already satisfied: pytest in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 18)) (6.2.1)\n",
      "Requirement already satisfied: setuptools>=41.4.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 21)) (46.1.3.post20200330)\n",
      "Requirement already satisfied: wheel>=0.33.6 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 22)) (0.34.2)\n",
      "Collecting arrow\n",
      "  Downloading arrow-0.17.0-py2.py3-none-any.whl (50 kB)\n",
      "\u001b[K     |████████████████████████████████| 50 kB 448 kB/s eta 0:00:01\n",
      "\u001b[?25hCollecting python-rapidjson\n",
      "  Downloading python_rapidjson-1.0-cp36-cp36m-macosx_10_9_x86_64.whl (201 kB)\n",
      "\u001b[K     |████████████████████████████████| 201 kB 315 kB/s eta 0:00:01\n",
      "\u001b[?25hCollecting questionary\n",
      "  Downloading questionary-1.9.0-py3-none-any.whl (32 kB)\n",
      "Collecting sqlalchemy\n",
      "  Downloading SQLAlchemy-1.3.23.tar.gz (6.3 MB)\n",
      "\u001b[K     |████████████████████████████████| 6.3 MB 507 kB/s eta 0:00:01\n",
      "\u001b[?25hCollecting tabulate\n",
      "  Downloading tabulate-0.8.7-py3-none-any.whl (24 kB)\n",
      "Collecting ccxt\n",
      "  Downloading ccxt-1.41.82-py2.py3-none-any.whl (2.0 MB)\n",
      "\u001b[K     |████████████████████████████████| 2.0 MB 2.3 MB/s eta 0:00:01\n",
      "\u001b[?25hRequirement already satisfied: colorama in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 35)) (0.4.4)\n",
      "Requirement already satisfied: tensorflow in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from -r requirements.txt (line 38)) (1.11.0)\n",
      "Collecting nest-asyncio\n",
      "  Downloading nest_asyncio-1.5.1-py3-none-any.whl (5.0 kB)\n",
      "Requirement already satisfied: pytz>=2017.2 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pandas>=1.1.5->-r requirements.txt (line 3)) (2020.1)\n",
      "Requirement already satisfied: python-dateutil>=2.7.3 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pandas>=1.1.5->-r requirements.txt (line 3)) (2.8.1)\n",
      "Requirement already satisfied: int-date>=0.1.7 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stockstats->-r requirements.txt (line 4)) (0.1.8)\n",
      "Requirement already satisfied: multitasking>=0.0.7 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from yfinance->-r requirements.txt (line 5)) (0.0.7)\n",
      "Requirement already satisfied: lxml>=4.5.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from yfinance->-r requirements.txt (line 5)) (4.5.2)\n",
      "Requirement already satisfied: requests>=2.20 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from yfinance->-r requirements.txt (line 5)) (2.23.0)\n",
      "Requirement already satisfied: ipython>=3.2.3 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pyfolio->-r requirements.txt (line 6)) (7.13.0)\n",
      "Requirement already satisfied: empyrical>=0.5.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pyfolio->-r requirements.txt (line 6)) (0.5.0)\n",
      "Requirement already satisfied: scipy>=0.14.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pyfolio->-r requirements.txt (line 6)) (1.4.1)\n",
      "Requirement already satisfied: seaborn>=0.7.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pyfolio->-r requirements.txt (line 6)) (0.10.1)\n",
      "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from matplotlib->-r requirements.txt (line 10)) (2.4.7)\n",
      "Requirement already satisfied: cycler>=0.10 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from matplotlib->-r requirements.txt (line 10)) (0.10.0)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from matplotlib->-r requirements.txt (line 10)) (1.2.0)\n",
      "Requirement already satisfied: joblib>=0.11 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from scikit-learn>=0.21.0->-r requirements.txt (line 13)) (0.15.1)\n",
      "Requirement already satisfied: Pillow<=7.2.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from gym>=0.17->-r requirements.txt (line 14)) (7.1.2)\n",
      "Requirement already satisfied: pyglet<=1.5.0,>=1.4.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from gym>=0.17->-r requirements.txt (line 14)) (1.5.0)\n",
      "Requirement already satisfied: cloudpickle<1.7.0,>=1.2.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from gym>=0.17->-r requirements.txt (line 14)) (1.4.1)\n",
      "Requirement already satisfied: torch>=1.4.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (1.7.1)\n",
      "Requirement already satisfied: opencv-python; extra == \"extra\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (3.4.3.18)\n",
      "Requirement already satisfied: atari-py~=0.2.0; extra == \"extra\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (0.2.6)\n",
      "Requirement already satisfied: psutil; extra == \"extra\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (5.7.0)\n",
      "Requirement already satisfied: tensorboard; extra == \"extra\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (1.11.0)\n",
      "Requirement already satisfied: importlib-metadata>=0.12; python_version < \"3.8\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (1.5.0)\n",
      "Requirement already satisfied: packaging in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (20.8)\n",
      "Requirement already satisfied: toml in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (0.10.2)\n",
      "Requirement already satisfied: iniconfig in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (1.1.1)\n",
      "Requirement already satisfied: attrs>=19.2.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (19.3.0)\n",
      "Requirement already satisfied: py>=1.8.2 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (1.10.0)\n",
      "Requirement already satisfied: pluggy<1.0.0a1,>=0.12 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pytest->-r requirements.txt (line 18)) (0.13.1)\n",
      "Requirement already satisfied: prompt_toolkit<4.0,>=2.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from questionary->-r requirements.txt (line 27)) (3.0.4)\n",
      "Collecting aiohttp<3.8,>=3.7.2; python_version >= \"3.5.2\"\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  Downloading aiohttp-3.7.3.tar.gz (1.1 MB)\n",
      "\u001b[K     |████████████████████████████████| 1.1 MB 289 kB/s eta 0:00:01\n",
      "\u001b[?25h  Installing build dependencies ... \u001b[?25ldone\n",
      "\u001b[?25h  Getting requirements to build wheel ... \u001b[?25ldone\n",
      "\u001b[?25h    Preparing wheel metadata ... \u001b[?25ldone\n",
      "\u001b[?25hRequirement already satisfied: cryptography>=2.6.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ccxt->-r requirements.txt (line 32)) (2.9.2)\n",
      "Requirement already satisfied: certifi>=2018.1.18 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ccxt->-r requirements.txt (line 32)) (2020.4.5.1)\n",
      "Collecting yarl==1.1.0; python_version >= \"3.5.2\"\n",
      "  Downloading yarl-1.1.0.tar.gz (156 kB)\n",
      "\u001b[K     |████████████████████████████████| 156 kB 2.1 MB/s eta 0:00:01\n",
      "\u001b[?25hCollecting aiodns<2.1,>=1.1.1; python_version >= \"3.5.2\"\n",
      "  Downloading aiodns-2.0.0-py2.py3-none-any.whl (4.8 kB)\n",
      "Requirement already satisfied: keras-applications>=1.0.5 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (1.0.6)\n",
      "Requirement already satisfied: six>=1.10.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (1.14.0)\n",
      "Requirement already satisfied: gast>=0.2.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (0.2.0)\n",
      "Requirement already satisfied: protobuf>=3.6.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (3.6.1)\n",
      "Requirement already satisfied: keras-preprocessing>=1.0.3 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (1.0.5)\n",
      "Requirement already satisfied: astor>=0.6.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (0.7.1)\n",
      "Requirement already satisfied: absl-py>=0.1.6 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (0.6.1)\n",
      "Requirement already satisfied: grpcio>=1.8.6 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (1.10.0)\n",
      "Requirement already satisfied: termcolor>=1.1.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorflow->-r requirements.txt (line 38)) (1.1.0)\n",
      "Requirement already satisfied: idna<3,>=2.5 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (2.9)\n",
      "Requirement already satisfied: chardet<4,>=3.0.2 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (3.0.4)\n",
      "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (1.25.8)\n",
      "Requirement already satisfied: pexpect; sys_platform != \"win32\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.8.0)\n",
      "Requirement already satisfied: jedi>=0.10 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.17.0)\n",
      "Requirement already satisfied: pickleshare in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.7.5)\n",
      "Requirement already satisfied: backcall in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.1.0)\n",
      "Requirement already satisfied: traitlets>=4.2 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.3.3)\n",
      "Requirement already satisfied: decorator in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.4.2)\n",
      "Requirement already satisfied: pygments in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (2.6.1)\n",
      "Requirement already satisfied: appnope; sys_platform == \"darwin\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.1.0)\n",
      "Requirement already satisfied: pandas-datareader>=0.2 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (0.6.0)\n",
      "Requirement already satisfied: bottleneck>=1.0.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (1.3.2)\n",
      "Requirement already satisfied: future in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pyglet<=1.5.0,>=1.4.0->gym>=0.17->-r requirements.txt (line 14)) (0.18.2)\n",
      "Requirement already satisfied: typing-extensions in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from torch>=1.4.0->stable-baselines3[extra]->-r requirements.txt (line 15)) (3.7.4.3)\n",
      "Requirement already satisfied: dataclasses; python_version < \"3.7\" in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from torch>=1.4.0->stable-baselines3[extra]->-r requirements.txt (line 15)) (0.6)\n",
      "Requirement already satisfied: markdown>=2.6.8 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (2.6.10)\n",
      "Requirement already satisfied: werkzeug>=0.11.10 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (1.0.1)\n",
      "Requirement already satisfied: zipp>=0.5 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from importlib-metadata>=0.12; python_version < \"3.8\"->pytest->-r requirements.txt (line 18)) (3.1.0)\n",
      "Requirement already satisfied: wcwidth in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from prompt_toolkit<4.0,>=2.0->questionary->-r requirements.txt (line 27)) (0.1.9)\n",
      "Collecting multidict<7.0,>=4.5\n",
      "  Downloading multidict-5.1.0.tar.gz (53 kB)\n",
      "\u001b[K     |████████████████████████████████| 53 kB 4.3 MB/s  eta 0:00:01\n",
      "\u001b[?25h  Installing build dependencies ... \u001b[?25ldone\n",
      "\u001b[?25h  Getting requirements to build wheel ... \u001b[?25ldone\n",
      "\u001b[?25h    Preparing wheel metadata ... \u001b[?25ldone\n",
      "\u001b[?25hCollecting idna-ssl>=1.0; python_version < \"3.7\"\n",
      "  Downloading idna-ssl-1.1.0.tar.gz (3.4 kB)\n",
      "Collecting async-timeout<4.0,>=3.0\n",
      "  Downloading async_timeout-3.0.1-py3-none-any.whl (8.2 kB)\n",
      "Requirement already satisfied: cffi!=1.11.3,>=1.8 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from cryptography>=2.6.1->ccxt->-r requirements.txt (line 32)) (1.14.0)\n",
      "Collecting pycares>=3.0.0\n",
      "  Downloading pycares-3.1.1-cp36-cp36m-macosx_10_6_intel.whl (121 kB)\n",
      "\u001b[K     |████████████████████████████████| 121 kB 2.0 MB/s eta 0:00:01\n",
      "\u001b[?25hCollecting typing; python_version < \"3.7\"\n",
      "  Downloading typing-3.7.4.3.tar.gz (78 kB)\n",
      "\u001b[K     |████████████████████████████████| 78 kB 1.8 MB/s eta 0:00:01\n",
      "\u001b[?25hRequirement already satisfied: h5py in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from keras-applications>=1.0.5->tensorflow->-r requirements.txt (line 38)) (2.10.0)\n",
      "Requirement already satisfied: ptyprocess>=0.5 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pexpect; sys_platform != \"win32\"->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.6.0)\n",
      "Requirement already satisfied: parso>=0.7.0 in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from jedi>=0.10->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.7.0)\n",
      "Requirement already satisfied: ipython-genutils in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from traitlets>=4.2->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.2.0)\n",
      "Requirement already satisfied: wrapt in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pandas-datareader>=0.2->empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (1.12.1)\n",
      "Requirement already satisfied: requests-file in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pandas-datareader>=0.2->empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (1.4.3)\n",
      "Requirement already satisfied: requests-ftp in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from pandas-datareader>=0.2->empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (0.3.1)\n",
      "Requirement already satisfied: pycparser in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.6.1->ccxt->-r requirements.txt (line 32)) (2.20)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Building wheels for collected packages: sqlalchemy, aiohttp, yarl, multidict, idna-ssl, typing\n",
      "  Building wheel for sqlalchemy (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for sqlalchemy: filename=SQLAlchemy-1.3.23-cp36-cp36m-macosx_10_9_x86_64.whl size=1212676 sha256=c94dfe19e4eb084275b30d6f29bca3dc7716bfb282a172fb66a19d75ce715e7d\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/32/54/3b/7b362f5fee72064f7a7b2be9c09ddf86db1c89eb2fdaf80d83\n",
      "  Building wheel for aiohttp (PEP 517) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for aiohttp: filename=aiohttp-3.7.3-cp36-cp36m-macosx_10_9_x86_64.whl size=649380 sha256=36cfd9f2583e418856ad7a780361a2d91633bb371666488ede738ecf21db9852\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/f7/88/5d/bcca02701f05b331bedbb260b9d639c33b74b173856b279f35\n",
      "  Building wheel for yarl (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for yarl: filename=yarl-1.1.0-cp36-cp36m-macosx_10_9_x86_64.whl size=123154 sha256=80ebc04aee150fdc3165aedde1af7e2b7d6758f2700ea6291e6cdcf5485881e3\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/4d/5e/41/f8ea3e75af106f3ec33177fdd848ee97108850d868e3fc3b86\n",
      "  Building wheel for multidict (PEP 517) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for multidict: filename=multidict-5.1.0-cp36-cp36m-macosx_10_9_x86_64.whl size=48971 sha256=45e7049b4f904165bd4279155d43ec68ad97de01659ef3991a315e5a2f9fe609\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/3d/bf/44/e80b368dba7799f46054fa4d825ff76a1f112716c22b2faf1b\n",
      "  Building wheel for idna-ssl (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for idna-ssl: filename=idna_ssl-1.1.0-py3-none-any.whl size=3161 sha256=d66c8eb1293c157bfdb9b9af5ba93dc6ec465850109b787e954abc4d0212ae0f\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/6a/f5/9c/f8331a854f7a8739cf0e74c13854e4dd7b1af11b04fe1dde13\n",
      "  Building wheel for typing (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for typing: filename=typing-3.7.4.3-py3-none-any.whl size=26308 sha256=3829f38fb26aea590868e9de658bcb956e47e0cd8afcf5da7f40a1135816800e\n",
      "  Stored in directory: /Users/hongyangyang/Library/Caches/pip/wheels/5f/63/c2/b85489bbea28cb5d36cfe197244f898428004fa3caa7a23116\n",
      "Successfully built sqlalchemy aiohttp yarl multidict idna-ssl typing\n",
      "Installing collected packages: arrow, python-rapidjson, questionary, sqlalchemy, tabulate, multidict, yarl, idna-ssl, async-timeout, aiohttp, pycares, typing, aiodns, ccxt, nest-asyncio\n",
      "Successfully installed aiodns-2.0.0 aiohttp-3.7.3 arrow-0.17.0 async-timeout-3.0.1 ccxt-1.41.82 idna-ssl-1.1.0 multidict-5.1.0 nest-asyncio-1.5.1 pycares-3.1.1 python-rapidjson-1.0 questionary-1.9.0 sqlalchemy-1.3.23 tabulate-0.8.7 typing-3.7.4.3 yarl-1.1.0\n",
      "Requirement already satisfied: nest-asyncio in /Users/hongyangyang/anaconda3/lib/python3.6/site-packages (1.5.1)\n"
     ]
    }
   ],
   "source": [
    "%cd FinRL-Library/\n",
    "!pip install -r requirements.txt\n",
    "!pip install nest-asyncio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 641
    },
    "id": "YOi7SNtgRbRx",
    "outputId": "b868e1eb-49ce-4d13-e1f3-dcd1ee603e04"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting ipython\n",
      "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/23/6a/210816c943c9aeeb29e4e18a298f14bf0e118fe222a23e13bfcc2d41b0a4/ipython-7.16.1-py3-none-any.whl (785kB)\n",
      "\u001b[K     |████████████████████████████████| 788kB 4.2MB/s \n",
      "\u001b[?25hRequirement already satisfied, skipping upgrade: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from ipython) (3.0.16)\n",
      "Requirement already satisfied, skipping upgrade: backcall in /usr/local/lib/python3.6/dist-packages (from ipython) (0.2.0)\n",
      "Requirement already satisfied, skipping upgrade: setuptools>=18.5 in /usr/local/lib/python3.6/dist-packages (from ipython) (53.0.0)\n",
      "Requirement already satisfied, skipping upgrade: jedi>=0.10 in /usr/local/lib/python3.6/dist-packages (from ipython) (0.18.0)\n",
      "Requirement already satisfied, skipping upgrade: traitlets>=4.2 in /usr/local/lib/python3.6/dist-packages (from ipython) (4.3.3)\n",
      "Requirement already satisfied, skipping upgrade: pygments in /usr/local/lib/python3.6/dist-packages (from ipython) (2.6.1)\n",
      "Requirement already satisfied, skipping upgrade: decorator in /usr/local/lib/python3.6/dist-packages (from ipython) (4.4.2)\n",
      "Requirement already satisfied, skipping upgrade: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython) (0.7.5)\n",
      "Requirement already satisfied, skipping upgrade: pexpect; sys_platform != \"win32\" in /usr/local/lib/python3.6/dist-packages (from ipython) (4.8.0)\n",
      "Requirement already satisfied, skipping upgrade: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython) (0.2.5)\n",
      "Requirement already satisfied, skipping upgrade: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.6/dist-packages (from jedi>=0.10->ipython) (0.8.1)\n",
      "Requirement already satisfied, skipping upgrade: six in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython) (1.15.0)\n",
      "Requirement already satisfied, skipping upgrade: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython) (0.2.0)\n",
      "Requirement already satisfied, skipping upgrade: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect; sys_platform != \"win32\"->ipython) (0.7.0)\n",
      "\u001b[31mERROR: jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 3.0.16 which is incompatible.\u001b[0m\n",
      "\u001b[31mERROR: google-colab 1.0.0 has requirement ipython~=5.5.0, but you'll have ipython 7.16.1 which is incompatible.\u001b[0m\n",
      "Installing collected packages: ipython\n",
      "  Found existing installation: ipython 5.5.0\n",
      "    Uninstalling ipython-5.5.0:\n",
      "      Successfully uninstalled ipython-5.5.0\n",
      "Successfully installed ipython-7.16.1\n"
     ]
    },
    {
     "data": {
      "application/vnd.colab-display-data+json": {
       "pip_warning": {
        "packages": [
         "IPython"
        ]
       }
      }
     },
     "metadata": {
      "tags": []
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "!pip install -U ipython\n",
    "# !pip install colorama"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "fDVBL-cDVWEP",
    "outputId": "88c7f5f2-1609-46f8-d68c-7de7be75b494"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Errno 2] No such file or directory: 'FinRL-Library/'\n",
      "/Users/hongyangyang/Documents/GitHub/finrl-library/FinRL-Library\n"
     ]
    }
   ],
   "source": [
    "%cd FinRL-Library/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "id": "7gc1cGFZLfKG"
   },
   "outputs": [],
   "source": [
    "import nest_asyncio\n",
    "nest_asyncio.apply()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "KTJUn-J9Ps0W",
    "outputId": "2f31216b-907c-49c3-9990-88814be987ce"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/hongyangyang/anaconda3/lib/python3.6/site-packages/empyrical/utils.py:32: UserWarning: Unable to import pandas_datareader. Suppressing import error and continuing. All data reading functionality will raise errors; but has been deprecated and will be removed in a later version.\n",
      "  warnings.warn(msg)\n",
      "/Users/hongyangyang/anaconda3/lib/python3.6/site-packages/pyfolio/pos.py:27: UserWarning: Module \"zipline.assets\" not found; multipliers will not be applied to position notionals.\n",
      "  'Module \"zipline.assets\" not found; multipliers will not be applied'\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "# matplotlib.use('Agg')\n",
    "import datetime\n",
    "\n",
    "%matplotlib inline\n",
    "from finrl.config import config\n",
    "from finrl.marketdata.yahoodownloader import YahooDownloader\n",
    "from finrl.preprocessing.preprocessors import FeatureEngineer\n",
    "from finrl.preprocessing.data import data_split\n",
    "from finrl.env.env_stocktrading import StockTradingEnv\n",
    "from finrl.model.models import DRLAgent\n",
    "from finrl.trade.backtest import backtest_stats, backtest_plot, get_daily_return, get_baseline\n",
    "\n",
    "from pprint import pprint\n",
    "\n",
    "import sys\n",
    "sys.path.append(\"../FinRL-Library\")\n",
    "\n",
    "import itertools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "id": "kWqK7-ryPwhQ"
   },
   "outputs": [],
   "source": [
    "import os\n",
    "if not os.path.exists(\"./\" + config.DATA_SAVE_DIR):\n",
    "    os.makedirs(\"./\" + config.DATA_SAVE_DIR)\n",
    "if not os.path.exists(\"./\" + config.TRAINED_MODEL_DIR):\n",
    "    os.makedirs(\"./\" + config.TRAINED_MODEL_DIR)\n",
    "if not os.path.exists(\"./\" + config.TENSORBOARD_LOG_DIR):\n",
    "    os.makedirs(\"./\" + config.TENSORBOARD_LOG_DIR)\n",
    "if not os.path.exists(\"./\" + config.RESULTS_DIR):\n",
    "    os.makedirs(\"./\" + config.RESULTS_DIR)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "id": "afDyaoplPzed"
   },
   "outputs": [],
   "source": [
    "from finrl.config.configuration import Configuration\n",
    "from finrl.config.directory_operations import create_userdata_dir\n",
    "from finrl.commands import start_download_cryptodata, start_download_stockdata"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "id": "p6UBynHyQtvV"
   },
   "outputs": [],
   "source": [
    "#### CREATE USER DATA DIRECTORY IN DESIGNATED PATH, IF NO NAME INDICATED DEFAULT TO user_data\n",
    "####### create dir to false if only to check existence of directory\n",
    "create_userdata_dir(\"./user_data\",create_dir=True)\n",
    "\n",
    "\n",
    "# ###### Pull Configuration File (using finrl/config/configuration.py)\n",
    "config = Configuration.from_files([\"config.json\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "jFrVhFlrbO-n",
    "outputId": "c2035991-c747-460b-f77e-9b2eeed3349d"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Exchange Binance has 111 active markets with B, N, B as quote currencies:\n",
      "+-----------+------------+--------+---------+----------+-----------+\n",
      "|        Id |     Symbol |   Base |   Quote |   Active |   Is pair |\n",
      "|-----------+------------+--------+---------+----------+-----------|\n",
      "|   AAVEBNB |   AAVE/BNB |   AAVE |     BNB |     True |      True |\n",
      "|    ADABNB |    ADA/BNB |    ADA |     BNB |     True |      True |\n",
      "|   ALGOBNB |   ALGO/BNB |   ALGO |     BNB |     True |      True |\n",
      "|  ALPHABNB |  ALPHA/BNB |  ALPHA |     BNB |     True |      True |\n",
      "|   ANKRBNB |   ANKR/BNB |   ANKR |     BNB |     True |      True |\n",
      "|    ANTBNB |    ANT/BNB |    ANT |     BNB |     True |      True |\n",
      "|   ARPABNB |   ARPA/BNB |   ARPA |     BNB |     True |      True |\n",
      "|   ATOMBNB |   ATOM/BNB |   ATOM |     BNB |     True |      True |\n",
      "|    AVABNB |    AVA/BNB |    AVA |     BNB |     True |      True |\n",
      "|   AVAXBNB |   AVAX/BNB |   AVAX |     BNB |     True |      True |\n",
      "|    AXSBNB |    AXS/BNB |    AXS |     BNB |     True |      True |\n",
      "|   BAKEBNB |   BAKE/BNB |   BAKE |     BNB |     True |      True |\n",
      "|   BANDBNB |   BAND/BNB |   BAND |     BNB |     True |      True |\n",
      "|    BATBNB |    BAT/BNB |    BAT |     BNB |     True |      True |\n",
      "|    BCHBNB |    BCH/BNB |    BCH |     BNB |     True |      True |\n",
      "|    BELBNB |    BEL/BNB |    BEL |     BNB |     True |      True |\n",
      "|    BLZBNB |    BLZ/BNB |    BLZ |     BNB |     True |      True |\n",
      "|    BTTBNB |    BTT/BNB |    BTT |     BNB |     True |      True |\n",
      "| BURGERBNB | BURGER/BNB | BURGER |     BNB |     True |      True |\n",
      "|   CAKEBNB |   CAKE/BNB |   CAKE |     BNB |     True |      True |\n",
      "|   CELRBNB |   CELR/BNB |   CELR |     BNB |     True |      True |\n",
      "|    CHRBNB |    CHR/BNB |    CHR |     BNB |     True |      True |\n",
      "|    CHZBNB |    CHZ/BNB |    CHZ |     BNB |     True |      True |\n",
      "|  COCOSBNB |  COCOS/BNB |  COCOS |     BNB |     True |      True |\n",
      "|    COSBNB |    COS/BNB |    COS |     BNB |     True |      True |\n",
      "|   COTIBNB |   COTI/BNB |   COTI |     BNB |     True |      True |\n",
      "|  CREAMBNB |  CREAM/BNB |  CREAM |     BNB |     True |      True |\n",
      "|    CRVBNB |    CRV/BNB |    CRV |     BNB |     True |      True |\n",
      "|    CTKBNB |    CTK/BNB |    CTK |     BNB |     True |      True |\n",
      "|   CTSIBNB |   CTSI/BNB |   CTSI |     BNB |     True |      True |\n",
      "|   DASHBNB |   DASH/BNB |   DASH |     BNB |     True |      True |\n",
      "|    DGBBNB |    DGB/BNB |    DGB |     BNB |     True |      True |\n",
      "|    DIABNB |    DIA/BNB |    DIA |     BNB |     True |      True |\n",
      "|    DOTBNB |    DOT/BNB |    DOT |     BNB |     True |      True |\n",
      "|   EGLDBNB |   EGLD/BNB |   EGLD |     BNB |     True |      True |\n",
      "|    ENJBNB |    ENJ/BNB |    ENJ |     BNB |     True |      True |\n",
      "|    EOSBNB |    EOS/BNB |    EOS |     BNB |     True |      True |\n",
      "|    ETCBNB |    ETC/BNB |    ETC |     BNB |     True |      True |\n",
      "|    FETBNB |    FET/BNB |    FET |     BNB |     True |      True |\n",
      "|    FILBNB |    FIL/BNB |    FIL |     BNB |     True |      True |\n",
      "|    FIOBNB |    FIO/BNB |    FIO |     BNB |     True |      True |\n",
      "|    FTMBNB |    FTM/BNB |    FTM |     BNB |     True |      True |\n",
      "|    FTTBNB |    FTT/BNB |    FTT |     BNB |     True |      True |\n",
      "|   HARDBNB |   HARD/BNB |   HARD |     BNB |     True |      True |\n",
      "|   HBARBNB |   HBAR/BNB |   HBAR |     BNB |     True |      True |\n",
      "|    HOTBNB |    HOT/BNB |    HOT |     BNB |     True |      True |\n",
      "|    ICXBNB |    ICX/BNB |    ICX |     BNB |     True |      True |\n",
      "|    INJBNB |    INJ/BNB |    INJ |     BNB |     True |      True |\n",
      "|   IOSTBNB |   IOST/BNB |   IOST |     BNB |     True |      True |\n",
      "|   IOTABNB |   IOTA/BNB |   IOTA |     BNB |     True |      True |\n",
      "|     IQBNB |     IQ/BNB |     IQ |     BNB |     True |      True |\n",
      "|    JSTBNB |    JST/BNB |    JST |     BNB |     True |      True |\n",
      "|   KAVABNB |   KAVA/BNB |   KAVA |     BNB |     True |      True |\n",
      "|   KP3RBNB |   KP3R/BNB |   KP3R |     BNB |     True |      True |\n",
      "|    KSMBNB |    KSM/BNB |    KSM |     BNB |     True |      True |\n",
      "|    LTCBNB |    LTC/BNB |    LTC |     BNB |     True |      True |\n",
      "|   LUNABNB |   LUNA/BNB |   LUNA |     BNB |     True |      True |\n",
      "|  MATICBNB |  MATIC/BNB |  MATIC |     BNB |     True |      True |\n",
      "|    MBLBNB |    MBL/BNB |    MBL |     BNB |     True |      True |\n",
      "|    MFTBNB |    MFT/BNB |    MFT |     BNB |     True |      True |\n",
      "|   MITHBNB |   MITH/BNB |   MITH |     BNB |     True |      True |\n",
      "|    MKRBNB |    MKR/BNB |    MKR |     BNB |     True |      True |\n",
      "|   NEARBNB |   NEAR/BNB |   NEAR |     BNB |     True |      True |\n",
      "|    NEOBNB |    NEO/BNB |    NEO |     BNB |     True |      True |\n",
      "|    NMRBNB |    NMR/BNB |    NMR |     BNB |     True |      True |\n",
      "|  OCEANBNB |  OCEAN/BNB |  OCEAN |     BNB |     True |      True |\n",
      "|    OGNBNB |    OGN/BNB |    OGN |     BNB |     True |      True |\n",
      "|    ONEBNB |    ONE/BNB |    ONE |     BNB |     True |      True |\n",
      "|    ONTBNB |    ONT/BNB |    ONT |     BNB |     True |      True |\n",
      "|   PAXGBNB |   PAXG/BNB |   PAXG |     BNB |     True |      True |\n",
      "|   PERLBNB |   PERL/BNB |   PERL |     BNB |     True |      True |\n",
      "|   PROMBNB |   PROM/BNB |   PROM |     BNB |     True |      True |\n",
      "|    RSRBNB |    RSR/BNB |    RSR |     BNB |     True |      True |\n",
      "|   RUNEBNB |   RUNE/BNB |   RUNE |     BNB |     True |      True |\n",
      "|    RVNBNB |    RVN/BNB |    RVN |     BNB |     True |      True |\n",
      "|   SANDBNB |   SAND/BNB |   SAND |     BNB |     True |      True |\n",
      "|     SCBNB |     SC/BNB |     SC |     BNB |     True |      True |\n",
      "|    SNXBNB |    SNX/BNB |    SNX |     BNB |     True |      True |\n",
      "|    SOLBNB |    SOL/BNB |    SOL |     BNB |     True |      True |\n",
      "| SPARTABNB | SPARTA/BNB | SPARTA |     BNB |     True |      True |\n",
      "|    SRMBNB |    SRM/BNB |    SRM |     BNB |     True |      True |\n",
      "|   STMXBNB |   STMX/BNB |   STMX |     BNB |     True |      True |\n",
      "|    STXBNB |    STX/BNB |    STX |     BNB |     True |      True |\n",
      "|  SUSHIBNB |  SUSHI/BNB |  SUSHI |     BNB |     True |      True |\n",
      "|   SWRVBNB |   SWRV/BNB |   SWRV |     BNB |     True |      True |\n",
      "|    SXPBNB |    SXP/BNB |    SXP |     BNB |     True |      True |\n",
      "|  THETABNB |  THETA/BNB |  THETA |     BNB |     True |      True |\n",
      "|   TROYBNB |   TROY/BNB |   TROY |     BNB |     True |      True |\n",
      "|    TRXBNB |    TRX/BNB |    TRX |     BNB |     True |      True |\n",
      "|   UNFIBNB |   UNFI/BNB |   UNFI |     BNB |     True |      True |\n",
      "|    UNIBNB |    UNI/BNB |    UNI |     BNB |     True |      True |\n",
      "|    VETBNB |    VET/BNB |    VET |     BNB |     True |      True |\n",
      "|   VTHOBNB |   VTHO/BNB |   VTHO |     BNB |     True |      True |\n",
      "|   WABIBNB |   WABI/BNB |   WABI |     BNB |     True |      True |\n",
      "|    WANBNB |    WAN/BNB |    WAN |     BNB |     True |      True |\n",
      "|  WAVESBNB |  WAVES/BNB |  WAVES |     BNB |     True |      True |\n",
      "|    WINBNB |    WIN/BNB |    WIN |     BNB |     True |      True |\n",
      "|   WINGBNB |   WING/BNB |   WING |     BNB |     True |      True |\n",
      "|   WNXMBNB |   WNXM/BNB |   WNXM |     BNB |     True |      True |\n",
      "|    WRXBNB |    WRX/BNB |    WRX |     BNB |     True |      True |\n",
      "|    WTCBNB |    WTC/BNB |    WTC |     BNB |     True |      True |\n",
      "|    XLMBNB |    XLM/BNB |    XLM |     BNB |     True |      True |\n",
      "|    XMRBNB |    XMR/BNB |    XMR |     BNB |     True |      True |\n",
      "|    XRPBNB |    XRP/BNB |    XRP |     BNB |     True |      True |\n",
      "|    XTZBNB |    XTZ/BNB |    XTZ |     BNB |     True |      True |\n",
      "|    XVSBNB |    XVS/BNB |    XVS |     BNB |     True |      True |\n",
      "|    YFIBNB |    YFI/BNB |    YFI |     BNB |     True |      True |\n",
      "|   YFIIBNB |   YFII/BNB |   YFII |     BNB |     True |      True |\n",
      "|    ZECBNB |    ZEC/BNB |    ZEC |     BNB |     True |      True |\n",
      "|    ZENBNB |    ZEN/BNB |    ZEN |     BNB |     True |      True |\n",
      "|    ZILBNB |    ZIL/BNB |    ZIL |     BNB |     True |      True |\n",
      "+-----------+------------+--------+---------+----------+-----------+\n"
     ]
    }
   ],
   "source": [
    "from finrl.commands import start_download_cryptodata, start_download_stockdata, start_list_markets\n",
    "\n",
    "#ARGS_LIST_PAIRS = [\"exchange\", \"print_list\", \"list_pairs_print_json\", \"print_one_column\",\n",
    "#                   \"print_csv\", \"base_currencies\", \"quote_currencies\", \"list_pairs_all\"]\n",
    "\n",
    "ARGS_LIST_PAIRS = {\"exchange\":config[\"exchange\"][\"name\"], \"quote_currencies\":\"BNB\"}\n",
    "\n",
    "x = start_list_markets(ARGS_LIST_PAIRS)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "6LyiTwxBeQam",
    "outputId": "2b54c059-515e-44bc-ef45-3dba097ddad8"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['WIN/BNB', 'COS/BNB', 'HOT/BNB', 'BTT/BNB', 'IOST/BNB', 'CELR/BNB', 'STMX/BNB', 'ONE/BNB', 'MBL/BNB', 'SAND/BNB', 'FIO/BNB', 'MITH/BNB', 'BLZ/BNB', 'ZIL/BNB', 'PERL/BNB', 'CHR/BNB', 'ANKR/BNB', 'XLM/BNB', 'OGN/BNB', 'HBAR/BNB']\n",
      "['WIN/BNB', 'COS/BNB', 'HOT/BNB', 'BTT/BNB', 'IOST/BNB', 'CELR/BNB', 'STMX/BNB', 'ONE/BNB', 'MBL/BNB', 'SAND/BNB', 'FIO/BNB', 'MITH/BNB', 'BLZ/BNB', 'ZIL/BNB', 'PERL/BNB', 'CHR/BNB', 'ANKR/BNB', 'XLM/BNB', 'OGN/BNB', 'HBAR/BNB']\n"
     ]
    }
   ],
   "source": [
    "from finrl.tools.coin_search import *\n",
    "import json\n",
    "#Search top Selling Coins based on Volume\n",
    "coins = coinSearch(\"BNB\", top=20)\n",
    "print(coins)\n",
    "#Add them to config file Pair_whitelist\n",
    "coins_to_json(\"./config.json\", coins)\n",
    "\n",
    "# reintialize config\n",
    "config = Configuration.from_files([\"config.json\"])\n",
    "\n",
    "#make sure the pairs are equal...\n",
    "print(config[\"exchange\"][\"pair_whitelist\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "id": "6HDb_jaLVkZ7"
   },
   "outputs": [],
   "source": [
    "ARGS_DOWNLOAD_DATA = {'config': ['config.json'], 'datadir': None, \n",
    "                      'user_data_dir': None, 'pairs': None, 'pairs_file': None, \n",
    "                      'days': 365, 'timerange': None, \n",
    "                      'download_trades': False, 'exchange': 'binance', \n",
    "                      'timeframes': ['4h'], 'erase': False, \n",
    "                      'dataformat_ohlcv': None, 'dataformat_trades': None}\n",
    "\n",
    "# ######## downloads data to our local data repository as dictated by our config, or we could overide it using 'datadir'\n",
    "start_download_cryptodata(ARGS_DOWNLOAD_DATA)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "id": "BRSgP8Ohfw4J"
   },
   "outputs": [],
   "source": [
    "from finrl.data.fetchdata import FetchData\n",
    "import pandas as pd\n",
    "from finrl.config import TimeRange"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "j_YbCR9_aYiY",
    "outputId": "ad70bd3c-8008-437e-f740-5f1497f3ecb5"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "coin WIN_BNB not available\n",
      "coin COS_BNB not available\n",
      "coin HOT_BNB not available\n",
      "coin BTT_BNB not available\n",
      "coin IOST_BNB not available\n",
      "coin CELR_BNB not available\n",
      "coin STMX_BNB not available\n",
      "coin ONE_BNB not available\n",
      "coin MBL_BNB not available\n",
      "coin SAND_BNB not available\n",
      "coin FIO_BNB not available\n",
      "coin MITH_BNB not available\n",
      "coin BLZ_BNB not available\n",
      "coin ZIL_BNB not available\n",
      "coin PERL_BNB not available\n",
      "coin CHR_BNB not available\n",
      "coin ANKR_BNB not available\n",
      "coin XLM_BNB not available\n",
      "coin OGN_BNB not available\n",
      "coin HBAR_BNB not available\n",
      "(0, 0)\n",
      "<bound method NDFrame.head of Empty DataFrame\n",
      "Columns: []\n",
      "Index: []>\n"
     ]
    }
   ],
   "source": [
    "df = FetchData(config).fetch_data_crypto()\n",
    "print(df.head)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 206
    },
    "id": "KGBpYLlBwPN1",
    "outputId": "46dc656b-14ae-460c-b239-dd6cb3ccc34c"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>tic</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>0.000032</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000031</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>15549743.0</td>\n",
       "      <td>HOT_BNB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-02-13 04:00:00</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000035</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>18295454.0</td>\n",
       "      <td>HOT_BNB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-02-13 08:00:00</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000036</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.000036</td>\n",
       "      <td>30499857.0</td>\n",
       "      <td>HOT_BNB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-02-13 12:00:00</td>\n",
       "      <td>0.000035</td>\n",
       "      <td>0.000036</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>32951545.0</td>\n",
       "      <td>HOT_BNB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-02-13 16:00:00</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>3948011.0</td>\n",
       "      <td>HOT_BNB</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 date      open      high  ...     close      volume      tic\n",
       "0 2020-02-13 00:00:00  0.000032  0.000034  ...  0.000034  15549743.0  HOT_BNB\n",
       "1 2020-02-13 04:00:00  0.000034  0.000035  ...  0.000033  18295454.0  HOT_BNB\n",
       "2 2020-02-13 08:00:00  0.000034  0.000036  ...  0.000036  30499857.0  HOT_BNB\n",
       "3 2020-02-13 12:00:00  0.000035  0.000036  ...  0.000034  32951545.0  HOT_BNB\n",
       "4 2020-02-13 16:00:00  0.000034  0.000034  ...  0.000034   3948011.0  HOT_BNB\n",
       "\n",
       "[5 rows x 7 columns]"
      ]
     },
     "execution_count": 79,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "TUn5EJuqhCaW",
    "outputId": "bcac6d59-6adc-4c2a-e0ad-5b25473329f7"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Successfully added technical indicators\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Index(['date', 'open', 'high', 'low', 'close', 'volume', 'tic', 'macd',\n",
       "       'boll_ub', 'boll_lb', 'rsi_30', 'cci_30', 'dx_30', 'close_30_sma',\n",
       "       'close_60_sma'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 80,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(['date','tic'],ignore_index=True).head()\n",
    "\n",
    "fe = FeatureEngineer(\n",
    "                    use_technical_indicator=True,\n",
    "                    tech_indicator_list = config[\"TECHNICAL_INDICATORS_LIST\"],\n",
    "                    use_turbulence=False,\n",
    "                    user_defined_feature = False)\n",
    "\n",
    "processed = fe.preprocess_data(df)\n",
    "processed.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "ztp-RmbQilsM",
    "outputId": "cd8de2d5-29a0-4ae4-aa80-10141eec6c99"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                 date      open  ...  close_30_sma  close_60_sma\n",
      "0 2020-02-13 00:00:00  0.000032  ...      0.000034      0.000034\n",
      "1 2020-02-13 04:00:00  0.000034  ...      0.000034      0.000034\n",
      "2 2020-02-13 08:00:00  0.000034  ...      0.000034      0.000034\n",
      "3 2020-02-13 12:00:00  0.000035  ...      0.000034      0.000034\n",
      "4 2020-02-13 16:00:00  0.000034  ...      0.000034      0.000034\n",
      "\n",
      "[5 rows x 15 columns]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(41151, 15)"
      ]
     },
     "execution_count": 81,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(processed.head())\n",
    "processed.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "tDt2xirSfhmv",
    "outputId": "4f95d0d6-60ad-4d49-cc73-b58d140f7e9b"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                    date      open  ...  close_30_sma  close_60_sma\n",
      "2186 2021-02-11 12:00:00  0.002038  ...      0.000011      0.000013\n",
      "2187 2021-02-11 16:00:00  0.001903  ...      0.000011      0.000013\n",
      "2188 2021-02-11 20:00:00  0.001925  ...      0.000011      0.000013\n",
      "2189 2021-02-12 00:00:00  0.001887  ...      0.000011      0.000012\n",
      "2190 2021-02-12 04:00:00  0.001833  ...      0.000011      0.000012\n",
      "\n",
      "[5 rows x 15 columns]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(41151, 15)"
      ]
     },
     "execution_count": 82,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(processed.tail())\n",
    "processed.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "CyLPP3t7i3gU",
    "outputId": "e2985149-ad59-4b56-d22e-72e9a3c39beb"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['2020-02-13 00:00:00',\n",
       " '2020-02-13 04:00:00',\n",
       " '2020-02-13 08:00:00',\n",
       " '2020-02-13 12:00:00',\n",
       " '2020-02-13 16:00:00',\n",
       " '2020-02-13 20:00:00',\n",
       " '2020-02-14 00:00:00',\n",
       " '2020-02-14 04:00:00',\n",
       " '2020-02-14 08:00:00',\n",
       " '2020-02-14 12:00:00',\n",
       " '2020-02-14 16:00:00',\n",
       " '2020-02-14 20:00:00',\n",
       " '2020-02-15 00:00:00',\n",
       " '2020-02-15 04:00:00',\n",
       " '2020-02-15 08:00:00',\n",
       " '2020-02-15 12:00:00',\n",
       " '2020-02-15 16:00:00',\n",
       " '2020-02-15 20:00:00',\n",
       " '2020-02-16 00:00:00',\n",
       " '2020-02-16 04:00:00',\n",
       " '2020-02-16 08:00:00',\n",
       " '2020-02-16 12:00:00',\n",
       " '2020-02-16 16:00:00',\n",
       " '2020-02-16 20:00:00',\n",
       " '2020-02-17 00:00:00',\n",
       " '2020-02-17 04:00:00',\n",
       " '2020-02-17 08:00:00',\n",
       " '2020-02-17 12:00:00',\n",
       " '2020-02-17 16:00:00',\n",
       " '2020-02-17 20:00:00',\n",
       " '2020-02-18 00:00:00',\n",
       " '2020-02-18 04:00:00',\n",
       " '2020-02-18 08:00:00',\n",
       " '2020-02-18 12:00:00',\n",
       " '2020-02-18 16:00:00',\n",
       " '2020-02-18 20:00:00',\n",
       " '2020-02-19 00:00:00',\n",
       " '2020-02-19 04:00:00',\n",
       " '2020-02-19 08:00:00',\n",
       " '2020-02-19 12:00:00',\n",
       " '2020-02-19 16:00:00',\n",
       " '2020-02-19 20:00:00',\n",
       " '2020-02-20 00:00:00',\n",
       " '2020-02-20 04:00:00',\n",
       " '2020-02-20 08:00:00',\n",
       " '2020-02-20 12:00:00',\n",
       " '2020-02-20 16:00:00',\n",
       " '2020-02-20 20:00:00',\n",
       " '2020-02-21 00:00:00',\n",
       " '2020-02-21 04:00:00',\n",
       " '2020-02-21 08:00:00',\n",
       " '2020-02-21 12:00:00',\n",
       " '2020-02-21 16:00:00',\n",
       " '2020-02-21 20:00:00',\n",
       " '2020-02-22 00:00:00',\n",
       " '2020-02-22 04:00:00',\n",
       " '2020-02-22 08:00:00',\n",
       " '2020-02-22 12:00:00',\n",
       " '2020-02-22 16:00:00',\n",
       " '2020-02-22 20:00:00',\n",
       " '2020-02-23 00:00:00',\n",
       " '2020-02-23 04:00:00',\n",
       " '2020-02-23 08:00:00',\n",
       " '2020-02-23 12:00:00',\n",
       " '2020-02-23 16:00:00',\n",
       " '2020-02-23 20:00:00',\n",
       " '2020-02-24 00:00:00',\n",
       " '2020-02-24 04:00:00',\n",
       " '2020-02-24 08:00:00',\n",
       " '2020-02-24 12:00:00',\n",
       " '2020-02-24 16:00:00',\n",
       " '2020-02-24 20:00:00',\n",
       " '2020-02-25 00:00:00',\n",
       " '2020-02-25 04:00:00',\n",
       " '2020-02-25 08:00:00',\n",
       " '2020-02-25 12:00:00',\n",
       " '2020-02-25 16:00:00',\n",
       " '2020-02-25 20:00:00',\n",
       " '2020-02-26 00:00:00',\n",
       " '2020-02-26 04:00:00',\n",
       " '2020-02-26 08:00:00',\n",
       " '2020-02-26 12:00:00',\n",
       " '2020-02-26 16:00:00',\n",
       " '2020-02-26 20:00:00',\n",
       " '2020-02-27 00:00:00',\n",
       " '2020-02-27 04:00:00',\n",
       " '2020-02-27 08:00:00',\n",
       " '2020-02-27 12:00:00',\n",
       " '2020-02-27 16:00:00',\n",
       " '2020-02-27 20:00:00',\n",
       " '2020-02-28 00:00:00',\n",
       " '2020-02-28 04:00:00',\n",
       " '2020-02-28 08:00:00',\n",
       " '2020-02-28 12:00:00',\n",
       " '2020-02-28 16:00:00',\n",
       " '2020-02-28 20:00:00',\n",
       " '2020-02-29 00:00:00',\n",
       " '2020-02-29 04:00:00',\n",
       " '2020-02-29 08:00:00',\n",
       " '2020-02-29 12:00:00',\n",
       " '2020-02-29 16:00:00',\n",
       " '2020-02-29 20:00:00',\n",
       " '2020-03-01 00:00:00',\n",
       " '2020-03-01 04:00:00',\n",
       " '2020-03-01 08:00:00',\n",
       " '2020-03-01 12:00:00',\n",
       " '2020-03-01 16:00:00',\n",
       " '2020-03-01 20:00:00',\n",
       " '2020-03-02 00:00:00',\n",
       " '2020-03-02 04:00:00',\n",
       " '2020-03-02 08:00:00',\n",
       " '2020-03-02 12:00:00',\n",
       " '2020-03-02 16:00:00',\n",
       " '2020-03-02 20:00:00',\n",
       " '2020-03-03 00:00:00',\n",
       " '2020-03-03 04:00:00',\n",
       " '2020-03-03 08:00:00',\n",
       " '2020-03-03 12:00:00',\n",
       " '2020-03-03 16:00:00',\n",
       " '2020-03-03 20:00:00',\n",
       " '2020-03-04 00:00:00',\n",
       " '2020-03-04 04:00:00',\n",
       " '2020-03-04 08:00:00',\n",
       " '2020-03-04 12:00:00',\n",
       " '2020-03-04 16:00:00',\n",
       " '2020-03-04 20:00:00',\n",
       " '2020-03-05 00:00:00',\n",
       " '2020-03-05 04:00:00',\n",
       " '2020-03-05 08:00:00',\n",
       " '2020-03-05 12:00:00',\n",
       " '2020-03-05 16:00:00',\n",
       " '2020-03-05 20:00:00',\n",
       " '2020-03-06 00:00:00',\n",
       " '2020-03-06 04:00:00',\n",
       " '2020-03-06 08:00:00',\n",
       " '2020-03-06 12:00:00',\n",
       " '2020-03-06 16:00:00',\n",
       " '2020-03-06 20:00:00',\n",
       " '2020-03-07 00:00:00',\n",
       " '2020-03-07 04:00:00',\n",
       " '2020-03-07 08:00:00',\n",
       " '2020-03-07 12:00:00',\n",
       " '2020-03-07 16:00:00',\n",
       " '2020-03-07 20:00:00',\n",
       " '2020-03-08 00:00:00',\n",
       " '2020-03-08 04:00:00',\n",
       " '2020-03-08 08:00:00',\n",
       " '2020-03-08 12:00:00',\n",
       " '2020-03-08 16:00:00',\n",
       " '2020-03-08 20:00:00',\n",
       " '2020-03-09 00:00:00',\n",
       " '2020-03-09 04:00:00',\n",
       " '2020-03-09 08:00:00',\n",
       " '2020-03-09 12:00:00',\n",
       " '2020-03-09 16:00:00',\n",
       " '2020-03-09 20:00:00',\n",
       " '2020-03-10 00:00:00',\n",
       " '2020-03-10 04:00:00',\n",
       " '2020-03-10 08:00:00',\n",
       " '2020-03-10 12:00:00',\n",
       " '2020-03-10 16:00:00',\n",
       " '2020-03-10 20:00:00',\n",
       " '2020-03-11 00:00:00',\n",
       " '2020-03-11 04:00:00',\n",
       " '2020-03-11 08:00:00',\n",
       " '2020-03-11 12:00:00',\n",
       " '2020-03-11 16:00:00',\n",
       " '2020-03-11 20:00:00',\n",
       " '2020-03-12 00:00:00',\n",
       " '2020-03-12 04:00:00',\n",
       " '2020-03-12 08:00:00',\n",
       " '2020-03-12 12:00:00',\n",
       " '2020-03-12 16:00:00',\n",
       " '2020-03-12 20:00:00',\n",
       " '2020-03-13 00:00:00',\n",
       " '2020-03-13 04:00:00',\n",
       " '2020-03-13 08:00:00',\n",
       " '2020-03-13 12:00:00',\n",
       " '2020-03-13 16:00:00',\n",
       " '2020-03-13 20:00:00',\n",
       " '2020-03-14 00:00:00',\n",
       " '2020-03-14 04:00:00',\n",
       " '2020-03-14 08:00:00',\n",
       " '2020-03-14 12:00:00',\n",
       " '2020-03-14 16:00:00',\n",
       " '2020-03-14 20:00:00',\n",
       " '2020-03-15 00:00:00',\n",
       " '2020-03-15 04:00:00',\n",
       " '2020-03-15 08:00:00',\n",
       " '2020-03-15 12:00:00',\n",
       " '2020-03-15 16:00:00',\n",
       " '2020-03-15 20:00:00',\n",
       " '2020-03-16 00:00:00',\n",
       " '2020-03-16 04:00:00',\n",
       " '2020-03-16 08:00:00',\n",
       " '2020-03-16 12:00:00',\n",
       " '2020-03-16 16:00:00',\n",
       " '2020-03-16 20:00:00',\n",
       " '2020-03-17 00:00:00',\n",
       " '2020-03-17 04:00:00',\n",
       " '2020-03-17 08:00:00',\n",
       " '2020-03-17 12:00:00',\n",
       " '2020-03-17 16:00:00',\n",
       " '2020-03-17 20:00:00',\n",
       " '2020-03-18 00:00:00',\n",
       " '2020-03-18 04:00:00',\n",
       " '2020-03-18 08:00:00',\n",
       " '2020-03-18 12:00:00',\n",
       " '2020-03-18 16:00:00',\n",
       " '2020-03-18 20:00:00',\n",
       " '2020-03-19 00:00:00',\n",
       " '2020-03-19 04:00:00',\n",
       " '2020-03-19 08:00:00',\n",
       " '2020-03-19 12:00:00',\n",
       " '2020-03-19 16:00:00',\n",
       " '2020-03-19 20:00:00',\n",
       " '2020-03-20 00:00:00',\n",
       " '2020-03-20 04:00:00',\n",
       " '2020-03-20 08:00:00',\n",
       " '2020-03-20 12:00:00',\n",
       " '2020-03-20 16:00:00',\n",
       " '2020-03-20 20:00:00',\n",
       " '2020-03-21 00:00:00',\n",
       " '2020-03-21 04:00:00',\n",
       " '2020-03-21 08:00:00',\n",
       " '2020-03-21 12:00:00',\n",
       " '2020-03-21 16:00:00',\n",
       " '2020-03-21 20:00:00',\n",
       " '2020-03-22 00:00:00',\n",
       " '2020-03-22 04:00:00',\n",
       " '2020-03-22 08:00:00',\n",
       " '2020-03-22 12:00:00',\n",
       " '2020-03-22 16:00:00',\n",
       " '2020-03-22 20:00:00',\n",
       " '2020-03-23 00:00:00',\n",
       " '2020-03-23 04:00:00',\n",
       " '2020-03-23 08:00:00',\n",
       " '2020-03-23 12:00:00',\n",
       " '2020-03-23 16:00:00',\n",
       " '2020-03-23 20:00:00',\n",
       " '2020-03-24 00:00:00',\n",
       " '2020-03-24 04:00:00',\n",
       " '2020-03-24 08:00:00',\n",
       " '2020-03-24 12:00:00',\n",
       " '2020-03-24 16:00:00',\n",
       " '2020-03-24 20:00:00',\n",
       " '2020-03-25 00:00:00',\n",
       " '2020-03-25 04:00:00',\n",
       " '2020-03-25 08:00:00',\n",
       " '2020-03-25 12:00:00',\n",
       " '2020-03-25 16:00:00',\n",
       " '2020-03-25 20:00:00',\n",
       " '2020-03-26 00:00:00',\n",
       " '2020-03-26 04:00:00',\n",
       " '2020-03-26 08:00:00',\n",
       " '2020-03-26 12:00:00',\n",
       " '2020-03-26 16:00:00',\n",
       " '2020-03-26 20:00:00',\n",
       " '2020-03-27 00:00:00',\n",
       " '2020-03-27 04:00:00',\n",
       " '2020-03-27 08:00:00',\n",
       " '2020-03-27 12:00:00',\n",
       " '2020-03-27 16:00:00',\n",
       " '2020-03-27 20:00:00',\n",
       " '2020-03-28 00:00:00',\n",
       " '2020-03-28 04:00:00',\n",
       " '2020-03-28 08:00:00',\n",
       " '2020-03-28 12:00:00',\n",
       " '2020-03-28 16:00:00',\n",
       " '2020-03-28 20:00:00',\n",
       " '2020-03-29 00:00:00',\n",
       " '2020-03-29 04:00:00',\n",
       " '2020-03-29 08:00:00',\n",
       " '2020-03-29 12:00:00',\n",
       " '2020-03-29 16:00:00',\n",
       " '2020-03-29 20:00:00',\n",
       " '2020-03-30 00:00:00',\n",
       " '2020-03-30 04:00:00',\n",
       " '2020-03-30 08:00:00',\n",
       " '2020-03-30 12:00:00',\n",
       " '2020-03-30 16:00:00',\n",
       " '2020-03-30 20:00:00',\n",
       " '2020-03-31 00:00:00',\n",
       " '2020-03-31 04:00:00',\n",
       " '2020-03-31 08:00:00',\n",
       " '2020-03-31 12:00:00',\n",
       " '2020-03-31 16:00:00',\n",
       " '2020-03-31 20:00:00',\n",
       " '2020-04-01 00:00:00',\n",
       " '2020-04-01 04:00:00',\n",
       " '2020-04-01 08:00:00',\n",
       " '2020-04-01 12:00:00',\n",
       " '2020-04-01 16:00:00',\n",
       " '2020-04-01 20:00:00',\n",
       " '2020-04-02 00:00:00',\n",
       " '2020-04-02 04:00:00',\n",
       " '2020-04-02 08:00:00',\n",
       " '2020-04-02 12:00:00',\n",
       " '2020-04-02 16:00:00',\n",
       " '2020-04-02 20:00:00',\n",
       " '2020-04-03 00:00:00',\n",
       " '2020-04-03 04:00:00',\n",
       " '2020-04-03 08:00:00',\n",
       " '2020-04-03 12:00:00',\n",
       " '2020-04-03 16:00:00',\n",
       " '2020-04-03 20:00:00',\n",
       " '2020-04-04 00:00:00',\n",
       " '2020-04-04 04:00:00',\n",
       " '2020-04-04 08:00:00',\n",
       " '2020-04-04 12:00:00',\n",
       " '2020-04-04 16:00:00',\n",
       " '2020-04-04 20:00:00',\n",
       " '2020-04-05 00:00:00',\n",
       " '2020-04-05 04:00:00',\n",
       " '2020-04-05 08:00:00',\n",
       " '2020-04-05 12:00:00',\n",
       " '2020-04-05 16:00:00',\n",
       " '2020-04-05 20:00:00',\n",
       " '2020-04-06 00:00:00',\n",
       " '2020-04-06 04:00:00',\n",
       " '2020-04-06 08:00:00',\n",
       " '2020-04-06 12:00:00',\n",
       " '2020-04-06 16:00:00',\n",
       " '2020-04-06 20:00:00',\n",
       " '2020-04-07 00:00:00',\n",
       " '2020-04-07 04:00:00',\n",
       " '2020-04-07 08:00:00',\n",
       " '2020-04-07 12:00:00',\n",
       " '2020-04-07 16:00:00',\n",
       " '2020-04-07 20:00:00',\n",
       " '2020-04-08 00:00:00',\n",
       " '2020-04-08 04:00:00',\n",
       " '2020-04-08 08:00:00',\n",
       " '2020-04-08 12:00:00',\n",
       " '2020-04-08 16:00:00',\n",
       " '2020-04-08 20:00:00',\n",
       " '2020-04-09 00:00:00',\n",
       " '2020-04-09 04:00:00',\n",
       " '2020-04-09 08:00:00',\n",
       " '2020-04-09 12:00:00',\n",
       " '2020-04-09 16:00:00',\n",
       " '2020-04-09 20:00:00',\n",
       " '2020-04-10 00:00:00',\n",
       " '2020-04-10 04:00:00',\n",
       " '2020-04-10 08:00:00',\n",
       " '2020-04-10 12:00:00',\n",
       " '2020-04-10 16:00:00',\n",
       " '2020-04-10 20:00:00',\n",
       " '2020-04-11 00:00:00',\n",
       " '2020-04-11 04:00:00',\n",
       " '2020-04-11 08:00:00',\n",
       " '2020-04-11 12:00:00',\n",
       " '2020-04-11 16:00:00',\n",
       " '2020-04-11 20:00:00',\n",
       " '2020-04-12 00:00:00',\n",
       " '2020-04-12 04:00:00',\n",
       " '2020-04-12 08:00:00',\n",
       " '2020-04-12 12:00:00',\n",
       " '2020-04-12 16:00:00',\n",
       " '2020-04-12 20:00:00',\n",
       " '2020-04-13 00:00:00',\n",
       " '2020-04-13 04:00:00',\n",
       " '2020-04-13 08:00:00',\n",
       " '2020-04-13 12:00:00',\n",
       " '2020-04-13 16:00:00',\n",
       " '2020-04-13 20:00:00',\n",
       " '2020-04-14 00:00:00',\n",
       " '2020-04-14 04:00:00',\n",
       " '2020-04-14 08:00:00',\n",
       " '2020-04-14 12:00:00',\n",
       " '2020-04-14 16:00:00',\n",
       " '2020-04-14 20:00:00',\n",
       " '2020-04-15 00:00:00',\n",
       " '2020-04-15 04:00:00',\n",
       " '2020-04-15 08:00:00',\n",
       " '2020-04-15 12:00:00',\n",
       " '2020-04-15 16:00:00',\n",
       " '2020-04-15 20:00:00',\n",
       " '2020-04-16 00:00:00',\n",
       " '2020-04-16 04:00:00',\n",
       " '2020-04-16 08:00:00',\n",
       " '2020-04-16 12:00:00',\n",
       " '2020-04-16 16:00:00',\n",
       " '2020-04-16 20:00:00',\n",
       " '2020-04-17 00:00:00',\n",
       " '2020-04-17 04:00:00',\n",
       " '2020-04-17 08:00:00',\n",
       " '2020-04-17 12:00:00',\n",
       " '2020-04-17 16:00:00',\n",
       " '2020-04-17 20:00:00',\n",
       " '2020-04-18 00:00:00',\n",
       " '2020-04-18 04:00:00',\n",
       " '2020-04-18 08:00:00',\n",
       " '2020-04-18 12:00:00',\n",
       " '2020-04-18 16:00:00',\n",
       " '2020-04-18 20:00:00',\n",
       " '2020-04-19 00:00:00',\n",
       " '2020-04-19 04:00:00',\n",
       " '2020-04-19 08:00:00',\n",
       " '2020-04-19 12:00:00',\n",
       " '2020-04-19 16:00:00',\n",
       " '2020-04-19 20:00:00',\n",
       " '2020-04-20 00:00:00',\n",
       " '2020-04-20 04:00:00',\n",
       " '2020-04-20 08:00:00',\n",
       " '2020-04-20 12:00:00',\n",
       " '2020-04-20 16:00:00',\n",
       " '2020-04-20 20:00:00',\n",
       " '2020-04-21 00:00:00',\n",
       " '2020-04-21 04:00:00',\n",
       " '2020-04-21 08:00:00',\n",
       " '2020-04-21 12:00:00',\n",
       " '2020-04-21 16:00:00',\n",
       " '2020-04-21 20:00:00',\n",
       " '2020-04-22 00:00:00',\n",
       " '2020-04-22 04:00:00',\n",
       " '2020-04-22 08:00:00',\n",
       " '2020-04-22 12:00:00',\n",
       " '2020-04-22 16:00:00',\n",
       " '2020-04-22 20:00:00',\n",
       " '2020-04-23 00:00:00',\n",
       " '2020-04-23 04:00:00',\n",
       " '2020-04-23 08:00:00',\n",
       " '2020-04-23 12:00:00',\n",
       " '2020-04-23 16:00:00',\n",
       " '2020-04-23 20:00:00',\n",
       " '2020-04-24 00:00:00',\n",
       " '2020-04-24 04:00:00',\n",
       " '2020-04-24 08:00:00',\n",
       " '2020-04-24 12:00:00',\n",
       " '2020-04-24 16:00:00',\n",
       " '2020-04-24 20:00:00',\n",
       " '2020-04-25 00:00:00',\n",
       " '2020-04-25 04:00:00',\n",
       " '2020-04-25 08:00:00',\n",
       " '2020-04-25 12:00:00',\n",
       " '2020-04-25 16:00:00',\n",
       " '2020-04-25 20:00:00',\n",
       " '2020-04-26 00:00:00',\n",
       " '2020-04-26 04:00:00',\n",
       " '2020-04-26 08:00:00',\n",
       " '2020-04-26 12:00:00',\n",
       " '2020-04-26 16:00:00',\n",
       " '2020-04-26 20:00:00',\n",
       " '2020-04-27 00:00:00',\n",
       " '2020-04-27 04:00:00',\n",
       " '2020-04-27 08:00:00',\n",
       " '2020-04-27 12:00:00',\n",
       " '2020-04-27 16:00:00',\n",
       " '2020-04-27 20:00:00',\n",
       " '2020-04-28 00:00:00',\n",
       " '2020-04-28 04:00:00',\n",
       " '2020-04-28 08:00:00',\n",
       " '2020-04-28 12:00:00',\n",
       " '2020-04-28 16:00:00',\n",
       " '2020-04-28 20:00:00',\n",
       " '2020-04-29 00:00:00',\n",
       " '2020-04-29 04:00:00',\n",
       " '2020-04-29 08:00:00',\n",
       " '2020-04-29 12:00:00',\n",
       " '2020-04-29 16:00:00',\n",
       " '2020-04-29 20:00:00',\n",
       " '2020-04-30 00:00:00',\n",
       " '2020-04-30 04:00:00',\n",
       " '2020-04-30 08:00:00',\n",
       " '2020-04-30 12:00:00',\n",
       " '2020-04-30 16:00:00',\n",
       " '2020-04-30 20:00:00',\n",
       " '2020-05-01 00:00:00',\n",
       " '2020-05-01 04:00:00',\n",
       " '2020-05-01 08:00:00',\n",
       " '2020-05-01 12:00:00',\n",
       " '2020-05-01 16:00:00',\n",
       " '2020-05-01 20:00:00',\n",
       " '2020-05-02 00:00:00',\n",
       " '2020-05-02 04:00:00',\n",
       " '2020-05-02 08:00:00',\n",
       " '2020-05-02 12:00:00',\n",
       " '2020-05-02 16:00:00',\n",
       " '2020-05-02 20:00:00',\n",
       " '2020-05-03 00:00:00',\n",
       " '2020-05-03 04:00:00',\n",
       " '2020-05-03 08:00:00',\n",
       " '2020-05-03 12:00:00',\n",
       " '2020-05-03 16:00:00',\n",
       " '2020-05-03 20:00:00',\n",
       " '2020-05-04 00:00:00',\n",
       " '2020-05-04 04:00:00',\n",
       " '2020-05-04 08:00:00',\n",
       " '2020-05-04 12:00:00',\n",
       " '2020-05-04 16:00:00',\n",
       " '2020-05-04 20:00:00',\n",
       " '2020-05-05 00:00:00',\n",
       " '2020-05-05 04:00:00',\n",
       " '2020-05-05 08:00:00',\n",
       " '2020-05-05 12:00:00',\n",
       " '2020-05-05 16:00:00',\n",
       " '2020-05-05 20:00:00',\n",
       " '2020-05-06 00:00:00',\n",
       " '2020-05-06 04:00:00',\n",
       " '2020-05-06 08:00:00',\n",
       " '2020-05-06 12:00:00',\n",
       " '2020-05-06 16:00:00',\n",
       " '2020-05-06 20:00:00',\n",
       " '2020-05-07 00:00:00',\n",
       " '2020-05-07 04:00:00',\n",
       " '2020-05-07 08:00:00',\n",
       " '2020-05-07 12:00:00',\n",
       " '2020-05-07 16:00:00',\n",
       " '2020-05-07 20:00:00',\n",
       " '2020-05-08 00:00:00',\n",
       " '2020-05-08 04:00:00',\n",
       " '2020-05-08 08:00:00',\n",
       " '2020-05-08 12:00:00',\n",
       " '2020-05-08 16:00:00',\n",
       " '2020-05-08 20:00:00',\n",
       " '2020-05-09 00:00:00',\n",
       " '2020-05-09 04:00:00',\n",
       " '2020-05-09 08:00:00',\n",
       " '2020-05-09 12:00:00',\n",
       " '2020-05-09 16:00:00',\n",
       " '2020-05-09 20:00:00',\n",
       " '2020-05-10 00:00:00',\n",
       " '2020-05-10 04:00:00',\n",
       " '2020-05-10 08:00:00',\n",
       " '2020-05-10 12:00:00',\n",
       " '2020-05-10 16:00:00',\n",
       " '2020-05-10 20:00:00',\n",
       " '2020-05-11 00:00:00',\n",
       " '2020-05-11 04:00:00',\n",
       " '2020-05-11 08:00:00',\n",
       " '2020-05-11 12:00:00',\n",
       " '2020-05-11 16:00:00',\n",
       " '2020-05-11 20:00:00',\n",
       " '2020-05-12 00:00:00',\n",
       " '2020-05-12 04:00:00',\n",
       " '2020-05-12 08:00:00',\n",
       " '2020-05-12 12:00:00',\n",
       " '2020-05-12 16:00:00',\n",
       " '2020-05-12 20:00:00',\n",
       " '2020-05-13 00:00:00',\n",
       " '2020-05-13 04:00:00',\n",
       " '2020-05-13 08:00:00',\n",
       " '2020-05-13 12:00:00',\n",
       " '2020-05-13 16:00:00',\n",
       " '2020-05-13 20:00:00',\n",
       " '2020-05-14 00:00:00',\n",
       " '2020-05-14 04:00:00',\n",
       " '2020-05-14 08:00:00',\n",
       " '2020-05-14 12:00:00',\n",
       " '2020-05-14 16:00:00',\n",
       " '2020-05-14 20:00:00',\n",
       " '2020-05-15 00:00:00',\n",
       " '2020-05-15 04:00:00',\n",
       " '2020-05-15 08:00:00',\n",
       " '2020-05-15 12:00:00',\n",
       " '2020-05-15 16:00:00',\n",
       " '2020-05-15 20:00:00',\n",
       " '2020-05-16 00:00:00',\n",
       " '2020-05-16 04:00:00',\n",
       " '2020-05-16 08:00:00',\n",
       " '2020-05-16 12:00:00',\n",
       " '2020-05-16 16:00:00',\n",
       " '2020-05-16 20:00:00',\n",
       " '2020-05-17 00:00:00',\n",
       " '2020-05-17 04:00:00',\n",
       " '2020-05-17 08:00:00',\n",
       " '2020-05-17 12:00:00',\n",
       " '2020-05-17 16:00:00',\n",
       " '2020-05-17 20:00:00',\n",
       " '2020-05-18 00:00:00',\n",
       " '2020-05-18 04:00:00',\n",
       " '2020-05-18 08:00:00',\n",
       " '2020-05-18 12:00:00',\n",
       " '2020-05-18 16:00:00',\n",
       " '2020-05-18 20:00:00',\n",
       " '2020-05-19 00:00:00',\n",
       " '2020-05-19 04:00:00',\n",
       " '2020-05-19 08:00:00',\n",
       " '2020-05-19 12:00:00',\n",
       " '2020-05-19 16:00:00',\n",
       " '2020-05-19 20:00:00',\n",
       " '2020-05-20 00:00:00',\n",
       " '2020-05-20 04:00:00',\n",
       " '2020-05-20 08:00:00',\n",
       " '2020-05-20 12:00:00',\n",
       " '2020-05-20 16:00:00',\n",
       " '2020-05-20 20:00:00',\n",
       " '2020-05-21 00:00:00',\n",
       " '2020-05-21 04:00:00',\n",
       " '2020-05-21 08:00:00',\n",
       " '2020-05-21 12:00:00',\n",
       " '2020-05-21 16:00:00',\n",
       " '2020-05-21 20:00:00',\n",
       " '2020-05-22 00:00:00',\n",
       " '2020-05-22 04:00:00',\n",
       " '2020-05-22 08:00:00',\n",
       " '2020-05-22 12:00:00',\n",
       " '2020-05-22 16:00:00',\n",
       " '2020-05-22 20:00:00',\n",
       " '2020-05-23 00:00:00',\n",
       " '2020-05-23 04:00:00',\n",
       " '2020-05-23 08:00:00',\n",
       " '2020-05-23 12:00:00',\n",
       " '2020-05-23 16:00:00',\n",
       " '2020-05-23 20:00:00',\n",
       " '2020-05-24 00:00:00',\n",
       " '2020-05-24 04:00:00',\n",
       " '2020-05-24 08:00:00',\n",
       " '2020-05-24 12:00:00',\n",
       " '2020-05-24 16:00:00',\n",
       " '2020-05-24 20:00:00',\n",
       " '2020-05-25 00:00:00',\n",
       " '2020-05-25 04:00:00',\n",
       " '2020-05-25 08:00:00',\n",
       " '2020-05-25 12:00:00',\n",
       " '2020-05-25 16:00:00',\n",
       " '2020-05-25 20:00:00',\n",
       " '2020-05-26 00:00:00',\n",
       " '2020-05-26 04:00:00',\n",
       " '2020-05-26 08:00:00',\n",
       " '2020-05-26 12:00:00',\n",
       " '2020-05-26 16:00:00',\n",
       " '2020-05-26 20:00:00',\n",
       " '2020-05-27 00:00:00',\n",
       " '2020-05-27 04:00:00',\n",
       " '2020-05-27 08:00:00',\n",
       " '2020-05-27 12:00:00',\n",
       " '2020-05-27 16:00:00',\n",
       " '2020-05-27 20:00:00',\n",
       " '2020-05-28 00:00:00',\n",
       " '2020-05-28 04:00:00',\n",
       " '2020-05-28 08:00:00',\n",
       " '2020-05-28 12:00:00',\n",
       " '2020-05-28 16:00:00',\n",
       " '2020-05-28 20:00:00',\n",
       " '2020-05-29 00:00:00',\n",
       " '2020-05-29 04:00:00',\n",
       " '2020-05-29 08:00:00',\n",
       " '2020-05-29 12:00:00',\n",
       " '2020-05-29 16:00:00',\n",
       " '2020-05-29 20:00:00',\n",
       " '2020-05-30 00:00:00',\n",
       " '2020-05-30 04:00:00',\n",
       " '2020-05-30 08:00:00',\n",
       " '2020-05-30 12:00:00',\n",
       " '2020-05-30 16:00:00',\n",
       " '2020-05-30 20:00:00',\n",
       " '2020-05-31 00:00:00',\n",
       " '2020-05-31 04:00:00',\n",
       " '2020-05-31 08:00:00',\n",
       " '2020-05-31 12:00:00',\n",
       " '2020-05-31 16:00:00',\n",
       " '2020-05-31 20:00:00',\n",
       " '2020-06-01 00:00:00',\n",
       " '2020-06-01 04:00:00',\n",
       " '2020-06-01 08:00:00',\n",
       " '2020-06-01 12:00:00',\n",
       " '2020-06-01 16:00:00',\n",
       " '2020-06-01 20:00:00',\n",
       " '2020-06-02 00:00:00',\n",
       " '2020-06-02 04:00:00',\n",
       " '2020-06-02 08:00:00',\n",
       " '2020-06-02 12:00:00',\n",
       " '2020-06-02 16:00:00',\n",
       " '2020-06-02 20:00:00',\n",
       " '2020-06-03 00:00:00',\n",
       " '2020-06-03 04:00:00',\n",
       " '2020-06-03 08:00:00',\n",
       " '2020-06-03 12:00:00',\n",
       " '2020-06-03 16:00:00',\n",
       " '2020-06-03 20:00:00',\n",
       " '2020-06-04 00:00:00',\n",
       " '2020-06-04 04:00:00',\n",
       " '2020-06-04 08:00:00',\n",
       " '2020-06-04 12:00:00',\n",
       " '2020-06-04 16:00:00',\n",
       " '2020-06-04 20:00:00',\n",
       " '2020-06-05 00:00:00',\n",
       " '2020-06-05 04:00:00',\n",
       " '2020-06-05 08:00:00',\n",
       " '2020-06-05 12:00:00',\n",
       " '2020-06-05 16:00:00',\n",
       " '2020-06-05 20:00:00',\n",
       " '2020-06-06 00:00:00',\n",
       " '2020-06-06 04:00:00',\n",
       " '2020-06-06 08:00:00',\n",
       " '2020-06-06 12:00:00',\n",
       " '2020-06-06 16:00:00',\n",
       " '2020-06-06 20:00:00',\n",
       " '2020-06-07 00:00:00',\n",
       " '2020-06-07 04:00:00',\n",
       " '2020-06-07 08:00:00',\n",
       " '2020-06-07 12:00:00',\n",
       " '2020-06-07 16:00:00',\n",
       " '2020-06-07 20:00:00',\n",
       " '2020-06-08 00:00:00',\n",
       " '2020-06-08 04:00:00',\n",
       " '2020-06-08 08:00:00',\n",
       " '2020-06-08 12:00:00',\n",
       " '2020-06-08 16:00:00',\n",
       " '2020-06-08 20:00:00',\n",
       " '2020-06-09 00:00:00',\n",
       " '2020-06-09 04:00:00',\n",
       " '2020-06-09 08:00:00',\n",
       " '2020-06-09 12:00:00',\n",
       " '2020-06-09 16:00:00',\n",
       " '2020-06-09 20:00:00',\n",
       " '2020-06-10 00:00:00',\n",
       " '2020-06-10 04:00:00',\n",
       " '2020-06-10 08:00:00',\n",
       " '2020-06-10 12:00:00',\n",
       " '2020-06-10 16:00:00',\n",
       " '2020-06-10 20:00:00',\n",
       " '2020-06-11 00:00:00',\n",
       " '2020-06-11 04:00:00',\n",
       " '2020-06-11 08:00:00',\n",
       " '2020-06-11 12:00:00',\n",
       " '2020-06-11 16:00:00',\n",
       " '2020-06-11 20:00:00',\n",
       " '2020-06-12 00:00:00',\n",
       " '2020-06-12 04:00:00',\n",
       " '2020-06-12 08:00:00',\n",
       " '2020-06-12 12:00:00',\n",
       " '2020-06-12 16:00:00',\n",
       " '2020-06-12 20:00:00',\n",
       " '2020-06-13 00:00:00',\n",
       " '2020-06-13 04:00:00',\n",
       " '2020-06-13 08:00:00',\n",
       " '2020-06-13 12:00:00',\n",
       " '2020-06-13 16:00:00',\n",
       " '2020-06-13 20:00:00',\n",
       " '2020-06-14 00:00:00',\n",
       " '2020-06-14 04:00:00',\n",
       " '2020-06-14 08:00:00',\n",
       " '2020-06-14 12:00:00',\n",
       " '2020-06-14 16:00:00',\n",
       " '2020-06-14 20:00:00',\n",
       " '2020-06-15 00:00:00',\n",
       " '2020-06-15 04:00:00',\n",
       " '2020-06-15 08:00:00',\n",
       " '2020-06-15 12:00:00',\n",
       " '2020-06-15 16:00:00',\n",
       " '2020-06-15 20:00:00',\n",
       " '2020-06-16 00:00:00',\n",
       " '2020-06-16 04:00:00',\n",
       " '2020-06-16 08:00:00',\n",
       " '2020-06-16 12:00:00',\n",
       " '2020-06-16 16:00:00',\n",
       " '2020-06-16 20:00:00',\n",
       " '2020-06-17 00:00:00',\n",
       " '2020-06-17 04:00:00',\n",
       " '2020-06-17 08:00:00',\n",
       " '2020-06-17 12:00:00',\n",
       " '2020-06-17 16:00:00',\n",
       " '2020-06-17 20:00:00',\n",
       " '2020-06-18 00:00:00',\n",
       " '2020-06-18 04:00:00',\n",
       " '2020-06-18 08:00:00',\n",
       " '2020-06-18 12:00:00',\n",
       " '2020-06-18 16:00:00',\n",
       " '2020-06-18 20:00:00',\n",
       " '2020-06-19 00:00:00',\n",
       " '2020-06-19 04:00:00',\n",
       " '2020-06-19 08:00:00',\n",
       " '2020-06-19 12:00:00',\n",
       " '2020-06-19 16:00:00',\n",
       " '2020-06-19 20:00:00',\n",
       " '2020-06-20 00:00:00',\n",
       " '2020-06-20 04:00:00',\n",
       " '2020-06-20 08:00:00',\n",
       " '2020-06-20 12:00:00',\n",
       " '2020-06-20 16:00:00',\n",
       " '2020-06-20 20:00:00',\n",
       " '2020-06-21 00:00:00',\n",
       " '2020-06-21 04:00:00',\n",
       " '2020-06-21 08:00:00',\n",
       " '2020-06-21 12:00:00',\n",
       " '2020-06-21 16:00:00',\n",
       " '2020-06-21 20:00:00',\n",
       " '2020-06-22 00:00:00',\n",
       " '2020-06-22 04:00:00',\n",
       " '2020-06-22 08:00:00',\n",
       " '2020-06-22 12:00:00',\n",
       " '2020-06-22 16:00:00',\n",
       " '2020-06-22 20:00:00',\n",
       " '2020-06-23 00:00:00',\n",
       " '2020-06-23 04:00:00',\n",
       " '2020-06-23 08:00:00',\n",
       " '2020-06-23 12:00:00',\n",
       " '2020-06-23 16:00:00',\n",
       " '2020-06-23 20:00:00',\n",
       " '2020-06-24 00:00:00',\n",
       " '2020-06-24 04:00:00',\n",
       " '2020-06-24 08:00:00',\n",
       " '2020-06-24 12:00:00',\n",
       " '2020-06-24 16:00:00',\n",
       " '2020-06-24 20:00:00',\n",
       " '2020-06-25 00:00:00',\n",
       " '2020-06-25 04:00:00',\n",
       " '2020-06-25 08:00:00',\n",
       " '2020-06-25 12:00:00',\n",
       " '2020-06-25 16:00:00',\n",
       " '2020-06-25 20:00:00',\n",
       " '2020-06-26 00:00:00',\n",
       " '2020-06-26 04:00:00',\n",
       " '2020-06-26 08:00:00',\n",
       " '2020-06-26 12:00:00',\n",
       " '2020-06-26 16:00:00',\n",
       " '2020-06-26 20:00:00',\n",
       " '2020-06-27 00:00:00',\n",
       " '2020-06-27 04:00:00',\n",
       " '2020-06-27 08:00:00',\n",
       " '2020-06-27 12:00:00',\n",
       " '2020-06-27 16:00:00',\n",
       " '2020-06-27 20:00:00',\n",
       " '2020-06-28 00:00:00',\n",
       " '2020-06-28 04:00:00',\n",
       " '2020-06-28 08:00:00',\n",
       " '2020-06-28 12:00:00',\n",
       " '2020-06-28 16:00:00',\n",
       " '2020-06-28 20:00:00',\n",
       " '2020-06-29 00:00:00',\n",
       " '2020-06-29 04:00:00',\n",
       " '2020-06-29 08:00:00',\n",
       " '2020-06-29 12:00:00',\n",
       " '2020-06-29 16:00:00',\n",
       " '2020-06-29 20:00:00',\n",
       " '2020-06-30 00:00:00',\n",
       " '2020-06-30 04:00:00',\n",
       " '2020-06-30 08:00:00',\n",
       " '2020-06-30 12:00:00',\n",
       " '2020-06-30 16:00:00',\n",
       " '2020-06-30 20:00:00',\n",
       " '2020-07-01 00:00:00',\n",
       " '2020-07-01 04:00:00',\n",
       " '2020-07-01 08:00:00',\n",
       " '2020-07-01 12:00:00',\n",
       " '2020-07-01 16:00:00',\n",
       " '2020-07-01 20:00:00',\n",
       " '2020-07-02 00:00:00',\n",
       " '2020-07-02 04:00:00',\n",
       " '2020-07-02 08:00:00',\n",
       " '2020-07-02 12:00:00',\n",
       " '2020-07-02 16:00:00',\n",
       " '2020-07-02 20:00:00',\n",
       " '2020-07-03 00:00:00',\n",
       " '2020-07-03 04:00:00',\n",
       " '2020-07-03 08:00:00',\n",
       " '2020-07-03 12:00:00',\n",
       " '2020-07-03 16:00:00',\n",
       " '2020-07-03 20:00:00',\n",
       " '2020-07-04 00:00:00',\n",
       " '2020-07-04 04:00:00',\n",
       " '2020-07-04 08:00:00',\n",
       " '2020-07-04 12:00:00',\n",
       " '2020-07-04 16:00:00',\n",
       " '2020-07-04 20:00:00',\n",
       " '2020-07-05 00:00:00',\n",
       " '2020-07-05 04:00:00',\n",
       " '2020-07-05 08:00:00',\n",
       " '2020-07-05 12:00:00',\n",
       " '2020-07-05 16:00:00',\n",
       " '2020-07-05 20:00:00',\n",
       " '2020-07-06 00:00:00',\n",
       " '2020-07-06 04:00:00',\n",
       " '2020-07-06 08:00:00',\n",
       " '2020-07-06 12:00:00',\n",
       " '2020-07-06 16:00:00',\n",
       " '2020-07-06 20:00:00',\n",
       " '2020-07-07 00:00:00',\n",
       " '2020-07-07 04:00:00',\n",
       " '2020-07-07 08:00:00',\n",
       " '2020-07-07 12:00:00',\n",
       " '2020-07-07 16:00:00',\n",
       " '2020-07-07 20:00:00',\n",
       " '2020-07-08 00:00:00',\n",
       " '2020-07-08 04:00:00',\n",
       " '2020-07-08 08:00:00',\n",
       " '2020-07-08 12:00:00',\n",
       " '2020-07-08 16:00:00',\n",
       " '2020-07-08 20:00:00',\n",
       " '2020-07-09 00:00:00',\n",
       " '2020-07-09 04:00:00',\n",
       " '2020-07-09 08:00:00',\n",
       " '2020-07-09 12:00:00',\n",
       " '2020-07-09 16:00:00',\n",
       " '2020-07-09 20:00:00',\n",
       " '2020-07-10 00:00:00',\n",
       " '2020-07-10 04:00:00',\n",
       " '2020-07-10 08:00:00',\n",
       " '2020-07-10 12:00:00',\n",
       " '2020-07-10 16:00:00',\n",
       " '2020-07-10 20:00:00',\n",
       " '2020-07-11 00:00:00',\n",
       " '2020-07-11 04:00:00',\n",
       " '2020-07-11 08:00:00',\n",
       " '2020-07-11 12:00:00',\n",
       " '2020-07-11 16:00:00',\n",
       " '2020-07-11 20:00:00',\n",
       " '2020-07-12 00:00:00',\n",
       " '2020-07-12 04:00:00',\n",
       " '2020-07-12 08:00:00',\n",
       " '2020-07-12 12:00:00',\n",
       " '2020-07-12 16:00:00',\n",
       " '2020-07-12 20:00:00',\n",
       " '2020-07-13 00:00:00',\n",
       " '2020-07-13 04:00:00',\n",
       " '2020-07-13 08:00:00',\n",
       " '2020-07-13 12:00:00',\n",
       " '2020-07-13 16:00:00',\n",
       " '2020-07-13 20:00:00',\n",
       " '2020-07-14 00:00:00',\n",
       " '2020-07-14 04:00:00',\n",
       " '2020-07-14 08:00:00',\n",
       " '2020-07-14 12:00:00',\n",
       " '2020-07-14 16:00:00',\n",
       " '2020-07-14 20:00:00',\n",
       " '2020-07-15 00:00:00',\n",
       " '2020-07-15 04:00:00',\n",
       " '2020-07-15 08:00:00',\n",
       " '2020-07-15 12:00:00',\n",
       " '2020-07-15 16:00:00',\n",
       " '2020-07-15 20:00:00',\n",
       " '2020-07-16 00:00:00',\n",
       " '2020-07-16 04:00:00',\n",
       " '2020-07-16 08:00:00',\n",
       " '2020-07-16 12:00:00',\n",
       " '2020-07-16 16:00:00',\n",
       " '2020-07-16 20:00:00',\n",
       " '2020-07-17 00:00:00',\n",
       " '2020-07-17 04:00:00',\n",
       " '2020-07-17 08:00:00',\n",
       " '2020-07-17 12:00:00',\n",
       " '2020-07-17 16:00:00',\n",
       " '2020-07-17 20:00:00',\n",
       " '2020-07-18 00:00:00',\n",
       " '2020-07-18 04:00:00',\n",
       " '2020-07-18 08:00:00',\n",
       " '2020-07-18 12:00:00',\n",
       " '2020-07-18 16:00:00',\n",
       " '2020-07-18 20:00:00',\n",
       " '2020-07-19 00:00:00',\n",
       " '2020-07-19 04:00:00',\n",
       " '2020-07-19 08:00:00',\n",
       " '2020-07-19 12:00:00',\n",
       " '2020-07-19 16:00:00',\n",
       " '2020-07-19 20:00:00',\n",
       " '2020-07-20 00:00:00',\n",
       " '2020-07-20 04:00:00',\n",
       " '2020-07-20 08:00:00',\n",
       " '2020-07-20 12:00:00',\n",
       " '2020-07-20 16:00:00',\n",
       " '2020-07-20 20:00:00',\n",
       " '2020-07-21 00:00:00',\n",
       " '2020-07-21 04:00:00',\n",
       " '2020-07-21 08:00:00',\n",
       " '2020-07-21 12:00:00',\n",
       " '2020-07-21 16:00:00',\n",
       " '2020-07-21 20:00:00',\n",
       " '2020-07-22 00:00:00',\n",
       " '2020-07-22 04:00:00',\n",
       " '2020-07-22 08:00:00',\n",
       " '2020-07-22 12:00:00',\n",
       " '2020-07-22 16:00:00',\n",
       " '2020-07-22 20:00:00',\n",
       " '2020-07-23 00:00:00',\n",
       " '2020-07-23 04:00:00',\n",
       " '2020-07-23 08:00:00',\n",
       " '2020-07-23 12:00:00',\n",
       " '2020-07-23 16:00:00',\n",
       " '2020-07-23 20:00:00',\n",
       " '2020-07-24 00:00:00',\n",
       " '2020-07-24 04:00:00',\n",
       " '2020-07-24 08:00:00',\n",
       " '2020-07-24 12:00:00',\n",
       " '2020-07-24 16:00:00',\n",
       " '2020-07-24 20:00:00',\n",
       " '2020-07-25 00:00:00',\n",
       " '2020-07-25 04:00:00',\n",
       " '2020-07-25 08:00:00',\n",
       " '2020-07-25 12:00:00',\n",
       " '2020-07-25 16:00:00',\n",
       " '2020-07-25 20:00:00',\n",
       " '2020-07-26 00:00:00',\n",
       " '2020-07-26 04:00:00',\n",
       " '2020-07-26 08:00:00',\n",
       " '2020-07-26 12:00:00',\n",
       " '2020-07-26 16:00:00',\n",
       " '2020-07-26 20:00:00',\n",
       " '2020-07-27 00:00:00',\n",
       " '2020-07-27 04:00:00',\n",
       " '2020-07-27 08:00:00',\n",
       " '2020-07-27 12:00:00',\n",
       " '2020-07-27 16:00:00',\n",
       " '2020-07-27 20:00:00',\n",
       " '2020-07-28 00:00:00',\n",
       " '2020-07-28 04:00:00',\n",
       " '2020-07-28 08:00:00',\n",
       " '2020-07-28 12:00:00',\n",
       " ...]"
      ]
     },
     "execution_count": 88,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list_ticker = processed[\"tic\"].unique().tolist()\n",
    "list_date = list(pd.date_range(processed['date'].min(),processed['date'].max(), freq=\"4h\").astype(str))\n",
    "combination = list(itertools.product(list_date,list_ticker))\n",
    "list_date"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 557
    },
    "id": "Tqf8X7rSjAiA",
    "outputId": "430fe0de-1737-403c-f41e-44ab1258064d"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>tic</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>ANKR_BNB</td>\n",
       "      <td>0.000073</td>\n",
       "      <td>0.000074</td>\n",
       "      <td>0.000069</td>\n",
       "      <td>0.000073</td>\n",
       "      <td>2516584.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>BTT_BNB</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000020</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>138086304.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>CELR_BNB</td>\n",
       "      <td>0.000179</td>\n",
       "      <td>0.000182</td>\n",
       "      <td>0.000176</td>\n",
       "      <td>0.000182</td>\n",
       "      <td>3780071.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>CHZ_BNB</td>\n",
       "      <td>0.000493</td>\n",
       "      <td>0.000510</td>\n",
       "      <td>0.000488</td>\n",
       "      <td>0.000502</td>\n",
       "      <td>408073.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>COS_BNB</td>\n",
       "      <td>0.000400</td>\n",
       "      <td>0.000407</td>\n",
       "      <td>0.000392</td>\n",
       "      <td>0.000402</td>\n",
       "      <td>202190.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>DGB_BNB</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>FET_BNB</td>\n",
       "      <td>0.002006</td>\n",
       "      <td>0.002014</td>\n",
       "      <td>0.001963</td>\n",
       "      <td>0.001998</td>\n",
       "      <td>247432.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>HOT_BNB</td>\n",
       "      <td>0.000032</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000031</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>15549743.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>IOST_BNB</td>\n",
       "      <td>0.000301</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>0.000296</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>993408.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>IQ_BNB</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  date       tic      open  ...  dx_30  close_30_sma  close_60_sma\n",
       "0  2020-02-13 00:00:00  ANKR_BNB  0.000073  ...  100.0      0.000034      0.000034\n",
       "1  2020-02-13 00:00:00   BTT_BNB  0.000019  ...  100.0      0.000034      0.000034\n",
       "2  2020-02-13 00:00:00  CELR_BNB  0.000179  ...  100.0      0.000034      0.000034\n",
       "3  2020-02-13 00:00:00   CHZ_BNB  0.000493  ...  100.0      0.000034      0.000034\n",
       "4  2020-02-13 00:00:00   COS_BNB  0.000400  ...  100.0      0.000034      0.000034\n",
       "5  2020-02-13 00:00:00   DGB_BNB  0.000000  ...    0.0      0.000000      0.000000\n",
       "6  2020-02-13 00:00:00   FET_BNB  0.002006  ...  100.0      0.000034      0.000034\n",
       "7  2020-02-13 00:00:00   HOT_BNB  0.000032  ...  100.0      0.000034      0.000034\n",
       "8  2020-02-13 00:00:00  IOST_BNB  0.000301  ...  100.0      0.000034      0.000034\n",
       "9  2020-02-13 00:00:00    IQ_BNB  0.000000  ...    0.0      0.000000      0.000000\n",
       "\n",
       "[10 rows x 15 columns]"
      ]
     },
     "execution_count": 89,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "processed[\"date\"] = processed[\"date\"].astype(str)\n",
    "processed_full = pd.DataFrame(combination,columns=[\"date\",\"tic\"]).merge(processed,on=[\"date\",\"tic\"],how=\"left\")\n",
    "processed_full = processed_full[processed_full['date'].isin(processed['date'])]\n",
    "processed_full = processed_full.fillna(0)\n",
    "processed_full.sort_values(['date','tic'],ignore_index=True).head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 313
    },
    "id": "e2zDnAijjDmw",
    "outputId": "76dccf28-4714-4351-b20c-f7864386d060"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>tic</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>HOT_BNB</td>\n",
       "      <td>0.000032</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000031</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>15549743.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>WIN_BNB</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>149131156.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>MBL_BNB</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>IOST_BNB</td>\n",
       "      <td>0.000301</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>0.000296</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>993408.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>BTT_BNB</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000020</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>138086304.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  date       tic      open  ...  dx_30  close_30_sma  close_60_sma\n",
       "0  2020-02-13 00:00:00   HOT_BNB  0.000032  ...  100.0      0.000034      0.000034\n",
       "1  2020-02-13 00:00:00   WIN_BNB  0.000005  ...  100.0      0.000034      0.000034\n",
       "2  2020-02-13 00:00:00   MBL_BNB  0.000000  ...    0.0      0.000000      0.000000\n",
       "3  2020-02-13 00:00:00  IOST_BNB  0.000301  ...  100.0      0.000034      0.000034\n",
       "4  2020-02-13 00:00:00   BTT_BNB  0.000019  ...  100.0      0.000034      0.000034\n",
       "\n",
       "[5 rows x 15 columns]"
      ]
     },
     "execution_count": 90,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "processed_full.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 313
    },
    "id": "EGmzTrtfjF5_",
    "outputId": "8c257417-ee93-440e-89e6-03e5b4836531"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>tic</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>43835</th>\n",
       "      <td>2021-02-12 04:00:00</td>\n",
       "      <td>XRP_BNB</td>\n",
       "      <td>0.004520</td>\n",
       "      <td>0.004520</td>\n",
       "      <td>0.004360</td>\n",
       "      <td>0.004480</td>\n",
       "      <td>1879686.5</td>\n",
       "      <td>-5.664967e-07</td>\n",
       "      <td>0.000015</td>\n",
       "      <td>0.000007</td>\n",
       "      <td>43.969435</td>\n",
       "      <td>-39.855452</td>\n",
       "      <td>28.33043</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43836</th>\n",
       "      <td>2021-02-12 04:00:00</td>\n",
       "      <td>XLM_BNB</td>\n",
       "      <td>0.003674</td>\n",
       "      <td>0.003769</td>\n",
       "      <td>0.003582</td>\n",
       "      <td>0.003666</td>\n",
       "      <td>378084.0</td>\n",
       "      <td>-5.664967e-07</td>\n",
       "      <td>0.000015</td>\n",
       "      <td>0.000007</td>\n",
       "      <td>43.969435</td>\n",
       "      <td>-39.855452</td>\n",
       "      <td>28.33043</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43837</th>\n",
       "      <td>2021-02-12 04:00:00</td>\n",
       "      <td>OGN_BNB</td>\n",
       "      <td>0.003100</td>\n",
       "      <td>0.003140</td>\n",
       "      <td>0.003030</td>\n",
       "      <td>0.003140</td>\n",
       "      <td>83444.1</td>\n",
       "      <td>-5.664967e-07</td>\n",
       "      <td>0.000015</td>\n",
       "      <td>0.000007</td>\n",
       "      <td>43.969435</td>\n",
       "      <td>-39.855452</td>\n",
       "      <td>28.33043</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43838</th>\n",
       "      <td>2021-02-12 04:00:00</td>\n",
       "      <td>MFT_BNB</td>\n",
       "      <td>0.000159</td>\n",
       "      <td>0.000180</td>\n",
       "      <td>0.000156</td>\n",
       "      <td>0.000172</td>\n",
       "      <td>50172888.0</td>\n",
       "      <td>-5.664967e-07</td>\n",
       "      <td>0.000015</td>\n",
       "      <td>0.000007</td>\n",
       "      <td>43.969435</td>\n",
       "      <td>-39.855452</td>\n",
       "      <td>28.33043</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43839</th>\n",
       "      <td>2021-02-12 04:00:00</td>\n",
       "      <td>FET_BNB</td>\n",
       "      <td>0.001833</td>\n",
       "      <td>0.002043</td>\n",
       "      <td>0.001810</td>\n",
       "      <td>0.001980</td>\n",
       "      <td>177638.0</td>\n",
       "      <td>-5.664967e-07</td>\n",
       "      <td>0.000015</td>\n",
       "      <td>0.000007</td>\n",
       "      <td>43.969435</td>\n",
       "      <td>-39.855452</td>\n",
       "      <td>28.33043</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      date      tic  ...  close_30_sma  close_60_sma\n",
       "43835  2021-02-12 04:00:00  XRP_BNB  ...      0.000011      0.000012\n",
       "43836  2021-02-12 04:00:00  XLM_BNB  ...      0.000011      0.000012\n",
       "43837  2021-02-12 04:00:00  OGN_BNB  ...      0.000011      0.000012\n",
       "43838  2021-02-12 04:00:00  MFT_BNB  ...      0.000011      0.000012\n",
       "43839  2021-02-12 04:00:00  FET_BNB  ...      0.000011      0.000012\n",
       "\n",
       "[5 rows x 15 columns]"
      ]
     },
     "execution_count": 91,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "processed_full.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "Q5Xg1GTz6-yW",
    "outputId": "0b104ca2-3fde-4d5d-f19c-04413201efe8"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "trade length:30673, train length: 13146.0, for total len of 43820 of 43820\n"
     ]
    }
   ],
   "source": [
    "#### DATA SPLIT TRAIN TRADE RATIO 70/30\n",
    "\n",
    "trade_len = int(len(processed_full)*0.7)\n",
    "train_len = int(len(processed_full)*0.3+1)\n",
    "total = trade_len+train_len\n",
    "print(f'trade length:{trade_len}, train length: {train}, for total len of {total} of {len(processed_full)}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "u5cgLBBO8C6_",
    "outputId": "eae93679-a625-46d3-b86c-3e47beeefdfd"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([   0,    0,    0, ..., 2190, 2190, 2190])"
      ]
     },
     "execution_count": 110,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "processed_full.date.factorize()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "rYIlHNSoJQXX",
    "outputId": "d0431d9e-7da7-40a6-f522-72ebfe1d3b62"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30640\n",
      "13160\n"
     ]
    }
   ],
   "source": [
    "train = data_split(processed_full, processed_full.date.min(),processed_full.date.loc[trade_len])\n",
    "trade = data_split(processed_full, processed_full.date.loc[trade_len],processed_full.date.max())\n",
    "print(len(train))\n",
    "print(len(trade))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "GPGqBNwKkT6i"
   },
   "outputs": [],
   "source": [
    "# processed_imputed = processed_full[processed_full.columns[processed_full.isna().any().tolist()]]\n",
    "\n",
    "# processed_imputed = processed_imputed.replace([np.inf, -np.inf], np.nan)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "STkGrzDl0bdx"
   },
   "outputs": [],
   "source": [
    "# from sklearn.impute import KNNImputer\n",
    "\n",
    "# imputer = KNNImputer(n_neighbors=1)\n",
    "# imputed = imputer.fit_transform(processed_imputed)\n",
    "\n",
    "# df_knn = pd.DataFrame(imputed, columns=processed_imputed.columns.tolist())\n",
    "\n",
    "# for i in processed_imputed.columns.tolist():\n",
    "#     processed_imputed[i] = df_knn[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "jiFq3gXR6KFO",
    "outputId": "db3a7959-ebb7-4bf6-a597-6ed5be720aa5"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "open            False\n",
      "high            False\n",
      "low             False\n",
      "close           False\n",
      "volume          False\n",
      "macd            False\n",
      "boll_ub         False\n",
      "boll_lb         False\n",
      "rsi_30          False\n",
      "cci_30          False\n",
      "dx_30           False\n",
      "close_30_sma    False\n",
      "close_60_sma    False\n",
      "dtype: bool\n"
     ]
    }
   ],
   "source": [
    "# print(processed_imputed.isna().any())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 226
    },
    "id": "0VEDSZuF61if",
    "outputId": "246ff6ca-e331-4369-f49d-f5a39ec1a51e"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.000744</td>\n",
       "      <td>0.000800</td>\n",
       "      <td>0.000696</td>\n",
       "      <td>0.000740</td>\n",
       "      <td>3.560429e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.00000</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0.085056</td>\n",
       "      <td>0.092740</td>\n",
       "      <td>0.077999</td>\n",
       "      <td>0.083463</td>\n",
       "      <td>7.923040e+07</td>\n",
       "      <td>-5.542309e-08</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>46.680829</td>\n",
       "      <td>-33.411206</td>\n",
       "      <td>25.08211</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>0.000004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0.085056</td>\n",
       "      <td>0.092740</td>\n",
       "      <td>0.077999</td>\n",
       "      <td>0.083463</td>\n",
       "      <td>7.923040e+07</td>\n",
       "      <td>-5.542309e-08</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>46.680829</td>\n",
       "      <td>-33.411206</td>\n",
       "      <td>25.08211</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>0.000004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.001993</td>\n",
       "      <td>0.002173</td>\n",
       "      <td>0.001975</td>\n",
       "      <td>0.002014</td>\n",
       "      <td>1.538142e+06</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.00000</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000005</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.085056</td>\n",
       "      <td>0.092740</td>\n",
       "      <td>0.077999</td>\n",
       "      <td>0.083463</td>\n",
       "      <td>7.923040e+07</td>\n",
       "      <td>-5.542309e-08</td>\n",
       "      <td>0.000005</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>46.680829</td>\n",
       "      <td>-33.411206</td>\n",
       "      <td>25.08211</td>\n",
       "      <td>0.000004</td>\n",
       "      <td>0.000004</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        open      high       low  ...      dx_30  close_30_sma  close_60_sma\n",
       "1   0.000744  0.000800  0.000696  ...  100.00000      0.000005      0.000005\n",
       "9   0.085056  0.092740  0.077999  ...   25.08211      0.000004      0.000004\n",
       "15  0.085056  0.092740  0.077999  ...   25.08211      0.000004      0.000004\n",
       "6   0.001993  0.002173  0.001975  ...  100.00000      0.000005      0.000005\n",
       "10  0.085056  0.092740  0.077999  ...   25.08211      0.000004      0.000004\n",
       "\n",
       "[5 rows x 13 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# processed_imputed.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 226
    },
    "id": "SM9gFk8Z638E",
    "outputId": "691edbfe-5b13-44ca-9888-113e81d4bfcf"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7291</th>\n",
       "      <td>0.000154</td>\n",
       "      <td>0.000155</td>\n",
       "      <td>0.000102</td>\n",
       "      <td>0.000115</td>\n",
       "      <td>144796641.0</td>\n",
       "      <td>-1.027257e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>40.610895</td>\n",
       "      <td>-193.348225</td>\n",
       "      <td>51.696729</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>0.000002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7288</th>\n",
       "      <td>0.000204</td>\n",
       "      <td>0.000216</td>\n",
       "      <td>0.000142</td>\n",
       "      <td>0.000174</td>\n",
       "      <td>40932841.0</td>\n",
       "      <td>-1.027257e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>40.610895</td>\n",
       "      <td>-193.348225</td>\n",
       "      <td>51.696729</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>0.000002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7280</th>\n",
       "      <td>0.000185</td>\n",
       "      <td>0.000185</td>\n",
       "      <td>0.000136</td>\n",
       "      <td>0.000145</td>\n",
       "      <td>14528466.0</td>\n",
       "      <td>-1.027257e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>40.610895</td>\n",
       "      <td>-193.348225</td>\n",
       "      <td>51.696729</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>0.000002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7299</th>\n",
       "      <td>0.000979</td>\n",
       "      <td>0.000991</td>\n",
       "      <td>0.000704</td>\n",
       "      <td>0.000804</td>\n",
       "      <td>9634840.0</td>\n",
       "      <td>-1.027257e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>40.610895</td>\n",
       "      <td>-193.348225</td>\n",
       "      <td>51.696729</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>0.000002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7296</th>\n",
       "      <td>0.000428</td>\n",
       "      <td>0.000430</td>\n",
       "      <td>0.000329</td>\n",
       "      <td>0.000359</td>\n",
       "      <td>66127973.0</td>\n",
       "      <td>-1.027257e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>40.610895</td>\n",
       "      <td>-193.348225</td>\n",
       "      <td>51.696729</td>\n",
       "      <td>0.000002</td>\n",
       "      <td>0.000002</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          open      high       low  ...      dx_30  close_30_sma  close_60_sma\n",
       "7291  0.000154  0.000155  0.000102  ...  51.696729      0.000002      0.000002\n",
       "7288  0.000204  0.000216  0.000142  ...  51.696729      0.000002      0.000002\n",
       "7280  0.000185  0.000185  0.000136  ...  51.696729      0.000002      0.000002\n",
       "7299  0.000979  0.000991  0.000704  ...  51.696729      0.000002      0.000002\n",
       "7296  0.000428  0.000430  0.000329  ...  51.696729      0.000002      0.000002\n",
       "\n",
       "[5 rows x 13 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# processed_imputed.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "bWk2rpWKii5K",
    "outputId": "54d9b1ab-4784-4c89-8e06-ab4adf034bd0"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(4891, 13)\n",
      "(2409, 13)\n"
     ]
    }
   ],
   "source": [
    "# from sklearn.model_selection import train_test_split \n",
    "# X = processed_imputed.astype(float).to_numpy()\n",
    "# train, trade = train_test_split(X, test_size=0.33, shuffle=False)\n",
    "# train = pd.DataFrame(train)\n",
    "# trade = pd.DataFrame(trade)\n",
    "# print(train.shape)\n",
    "# print(trade.shape)\n",
    "# # train = data_split(processed_full, '2018-05-16','2020-05-16')\n",
    "# # trade = data_split(processed_full, '2020-05-17','2021-02-10')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "ORu4o8-yDzgp",
    "outputId": "ec36442a-a0b5-4e0a-f055-d6ec5f60d48c"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     2020-02-12\n",
       "9     2020-02-12\n",
       "15    2020-02-12\n",
       "6     2020-02-12\n",
       "10    2020-02-12\n",
       "Name: date, dtype: object"
      ]
     },
     "execution_count": 25,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# processed_full.date.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "Nwe8UeDXAtmT"
   },
   "outputs": [],
   "source": [
    "# train[[\"date\",\"tic\"]] = processed_full[[\"date\",\"tic\"]].iloc[:len(train),:]\n",
    "# train.columns = processed_full.columns\n",
    "# train = train.sort_values([\"date\", \"tic\"], ignore_index=True)\n",
    "# train.index = train.date.factorize()[0]\n",
    "# trade[[\"date\",\"tic\"]] = processed_full[[\"date\",\"tic\"]].iloc[:len(trade),:]\n",
    "# trade.columns = processed_full.columns\n",
    "# trade = trade.sort_values([\"date\", \"tic\"], ignore_index=True)\n",
    "# trade.index = trade.date.factorize()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 313
    },
    "id": "M0ULGxgc__uk",
    "outputId": "6d4522ee-768e-482c-f87a-6e08f5abcead"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>tic</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>ANKR_BNB</td>\n",
       "      <td>0.000073</td>\n",
       "      <td>0.000074</td>\n",
       "      <td>0.000069</td>\n",
       "      <td>0.000073</td>\n",
       "      <td>2516584.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>BTT_BNB</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000020</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>0.000019</td>\n",
       "      <td>138086304.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>CELR_BNB</td>\n",
       "      <td>0.000179</td>\n",
       "      <td>0.000182</td>\n",
       "      <td>0.000176</td>\n",
       "      <td>0.000182</td>\n",
       "      <td>3780071.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>CHZ_BNB</td>\n",
       "      <td>0.000493</td>\n",
       "      <td>0.000510</td>\n",
       "      <td>0.000488</td>\n",
       "      <td>0.000502</td>\n",
       "      <td>408073.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-02-13 00:00:00</td>\n",
       "      <td>COS_BNB</td>\n",
       "      <td>0.000400</td>\n",
       "      <td>0.000407</td>\n",
       "      <td>0.000392</td>\n",
       "      <td>0.000402</td>\n",
       "      <td>202190.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000033</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.666667</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.000034</td>\n",
       "      <td>0.000034</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  date       tic      open  ...  dx_30  close_30_sma  close_60_sma\n",
       "0  2020-02-13 00:00:00  ANKR_BNB  0.000073  ...  100.0      0.000034      0.000034\n",
       "0  2020-02-13 00:00:00   BTT_BNB  0.000019  ...  100.0      0.000034      0.000034\n",
       "0  2020-02-13 00:00:00  CELR_BNB  0.000179  ...  100.0      0.000034      0.000034\n",
       "0  2020-02-13 00:00:00   CHZ_BNB  0.000493  ...  100.0      0.000034      0.000034\n",
       "0  2020-02-13 00:00:00   COS_BNB  0.000400  ...  100.0      0.000034      0.000034\n",
       "\n",
       "[5 rows x 15 columns]"
      ]
     },
     "execution_count": 113,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 313
    },
    "id": "NZmYW7__ABby",
    "outputId": "81da5b04-95b9-4f7d-e0a3-df4f5d234af2"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>tic</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>volume</th>\n",
       "      <th>macd</th>\n",
       "      <th>boll_ub</th>\n",
       "      <th>boll_lb</th>\n",
       "      <th>rsi_30</th>\n",
       "      <th>cci_30</th>\n",
       "      <th>dx_30</th>\n",
       "      <th>close_30_sma</th>\n",
       "      <th>close_60_sma</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>ANKR_BNB</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>0.000311</td>\n",
       "      <td>0.000304</td>\n",
       "      <td>0.000309</td>\n",
       "      <td>2706102.0</td>\n",
       "      <td>-3.232500e-08</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "      <td>48.883772</td>\n",
       "      <td>-115.05199</td>\n",
       "      <td>6.142612</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>BTT_BNB</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>0.000011</td>\n",
       "      <td>23613679.0</td>\n",
       "      <td>-3.232500e-08</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "      <td>48.883772</td>\n",
       "      <td>-115.05199</td>\n",
       "      <td>6.142612</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>CELR_BNB</td>\n",
       "      <td>0.000142</td>\n",
       "      <td>0.000142</td>\n",
       "      <td>0.000140</td>\n",
       "      <td>0.000141</td>\n",
       "      <td>31027.0</td>\n",
       "      <td>-3.232500e-08</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "      <td>48.883772</td>\n",
       "      <td>-115.05199</td>\n",
       "      <td>6.142612</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>CHZ_BNB</td>\n",
       "      <td>0.000354</td>\n",
       "      <td>0.000359</td>\n",
       "      <td>0.000349</td>\n",
       "      <td>0.000356</td>\n",
       "      <td>412976.0</td>\n",
       "      <td>-3.232500e-08</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "      <td>48.883772</td>\n",
       "      <td>-115.05199</td>\n",
       "      <td>6.142612</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>COS_BNB</td>\n",
       "      <td>0.000217</td>\n",
       "      <td>0.000219</td>\n",
       "      <td>0.000216</td>\n",
       "      <td>0.000219</td>\n",
       "      <td>64177.0</td>\n",
       "      <td>-3.232500e-08</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "      <td>48.883772</td>\n",
       "      <td>-115.05199</td>\n",
       "      <td>6.142612</td>\n",
       "      <td>0.000017</td>\n",
       "      <td>0.000016</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  date       tic  ...  close_30_sma  close_60_sma\n",
       "0  2020-10-25 12:00:00  ANKR_BNB  ...      0.000017      0.000016\n",
       "0  2020-10-25 12:00:00   BTT_BNB  ...      0.000017      0.000016\n",
       "0  2020-10-25 12:00:00  CELR_BNB  ...      0.000017      0.000016\n",
       "0  2020-10-25 12:00:00   CHZ_BNB  ...      0.000017      0.000016\n",
       "0  2020-10-25 12:00:00   COS_BNB  ...      0.000017      0.000016\n",
       "\n",
       "[5 rows x 15 columns]"
      ]
     },
     "execution_count": 114,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trade.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "xMwZJEmnB_4D",
    "outputId": "dda7830a-754d-4fbd-c44a-7e2975d1a562"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 30640 entries, 0 to 1531\n",
      "Data columns (total 15 columns):\n",
      " #   Column        Non-Null Count  Dtype  \n",
      "---  ------        --------------  -----  \n",
      " 0   date          30640 non-null  object \n",
      " 1   tic           30640 non-null  object \n",
      " 2   open          30640 non-null  float64\n",
      " 3   high          30640 non-null  float64\n",
      " 4   low           30640 non-null  float64\n",
      " 5   close         30640 non-null  float64\n",
      " 6   volume        30640 non-null  float64\n",
      " 7   macd          30640 non-null  float64\n",
      " 8   boll_ub       30640 non-null  float64\n",
      " 9   boll_lb       30640 non-null  float64\n",
      " 10  rsi_30        30640 non-null  float64\n",
      " 11  cci_30        30640 non-null  float64\n",
      " 12  dx_30         30640 non-null  float64\n",
      " 13  close_30_sma  30640 non-null  float64\n",
      " 14  close_60_sma  30640 non-null  float64\n",
      "dtypes: float64(13), object(2)\n",
      "memory usage: 3.7+ MB\n"
     ]
    }
   ],
   "source": [
    "train.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "8ceHuwSUC6xW",
    "outputId": "2aee7049-e93b-4502-ee0f-fead98fe7163"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 116,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(train.tic.unique())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "nKWnrUetC_YE",
    "outputId": "812add7d-5d6e-474b-bd45-50b906821cfb"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['macd',\n",
       " 'boll_ub',\n",
       " 'boll_lb',\n",
       " 'rsi_30',\n",
       " 'cci_30',\n",
       " 'dx_30',\n",
       " 'close_30_sma',\n",
       " 'close_60_sma']"
      ]
     },
     "execution_count": 117,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "config[\"TECHNICAL_INDICATORS_LIST\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "Sc4Yix3G0U2g",
    "outputId": "90d1bc6e-272e-44f6-92f9-37260cd8d02b"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Stock Dimension: 20, State Space: 201\n"
     ]
    }
   ],
   "source": [
    "stock_dimension = len(train.tic.unique())\n",
    "state_space = 1 + 2*stock_dimension + len(config[\"TECHNICAL_INDICATORS_LIST\"])*stock_dimension\n",
    "print(f\"Stock Dimension: {stock_dimension}, State Space: {state_space}\")\n",
    "\n",
    "env_kwargs = {\n",
    "    \"hmax\": 100, \n",
    "    \"initial_amount\": 1000000, \n",
    "    \"buy_cost_pct\": 0.001,\n",
    "    \"sell_cost_pct\": 0.001,\n",
    "    \"state_space\": state_space, \n",
    "    \"stock_dim\": stock_dimension, \n",
    "    \"tech_indicator_list\": config[\"TECHNICAL_INDICATORS_LIST\"], \n",
    "    \"action_space\": stock_dimension, \n",
    "    \"reward_scaling\": 1e-4\n",
    "    \n",
    "}\n",
    "e_train_gym = StockTradingEnv(df = train, **env_kwargs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "yRzxB84E_pR0",
    "outputId": "1340b797-2d1a-4fe2-b6ec-887df08b0c91"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'stable_baselines3.common.vec_env.dummy_vec_env.DummyVecEnv'>\n"
     ]
    }
   ],
   "source": [
    "env_train, _ = e_train_gym.get_sb_env()\n",
    "print(type(env_train))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "8V-ppne7Cv2T",
    "outputId": "d2531919-ee1f-418e-fcef-c44f4a015a01"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'n_steps': 2048, 'ent_coef': 0.01, 'learning_rate': 0.00025, 'batch_size': 128}\n",
      "Using cpu device\n"
     ]
    }
   ],
   "source": [
    "agent = DRLAgent(env = env_train)\n",
    "PPO_PARAMS = {\n",
    "    \"n_steps\": 2048,\n",
    "    \"ent_coef\": 0.01,\n",
    "    \"learning_rate\": 0.00025,\n",
    "    \"batch_size\": 128,\n",
    "}\n",
    "model_ppo = agent.get_model(\"ppo\",model_kwargs = PPO_PARAMS)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "2m48yLBrJ3in",
    "outputId": "3d1f9b11-228a-452f-95e7-f328d61f8447"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Logging to tensorboard_log/ppo/ppo_1\n",
      "----------------------------------\n",
      "| environment/        |          |\n",
      "|    portfolio_value  | 1e+06    |\n",
      "|    total_cost       | 3.51     |\n",
      "|    total_reward     | -61.6    |\n",
      "|    total_reward_pct | -0.00616 |\n",
      "|    total_trades     | 27296    |\n",
      "| time/               |          |\n",
      "|    fps              | 149      |\n",
      "|    iterations       | 1        |\n",
      "|    time_elapsed     | 13       |\n",
      "|    total_timesteps  | 2048     |\n",
      "----------------------------------\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.45       |\n",
      "|    total_reward         | -53.1      |\n",
      "|    total_reward_pct     | -0.00531   |\n",
      "|    total_trades         | 27366      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 157        |\n",
      "|    iterations           | 2          |\n",
      "|    time_elapsed         | 26         |\n",
      "|    total_timesteps      | 4096       |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.02352301 |\n",
      "|    clip_fraction        | 0.251      |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -28.4      |\n",
      "|    explained_variance   | -4.4e+11   |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.295     |\n",
      "|    n_updates            | 10         |\n",
      "|    policy_gradient_loss | -0.00456   |\n",
      "|    std                  | 1.01       |\n",
      "|    value_loss           | 0.00205    |\n",
      "----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.46        |\n",
      "|    total_reward         | -107        |\n",
      "|    total_reward_pct     | -0.0107     |\n",
      "|    total_trades         | 27337       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 160         |\n",
      "|    iterations           | 3           |\n",
      "|    time_elapsed         | 38          |\n",
      "|    total_timesteps      | 6144        |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.017767336 |\n",
      "|    clip_fraction        | 0.255       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -28.5       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.304      |\n",
      "|    n_updates            | 20          |\n",
      "|    policy_gradient_loss | -0.00961    |\n",
      "|    std                  | 1.01        |\n",
      "|    value_loss           | 0.00159     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.57        |\n",
      "|    total_reward         | -132        |\n",
      "|    total_reward_pct     | -0.0132     |\n",
      "|    total_trades         | 27255       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 161         |\n",
      "|    iterations           | 4           |\n",
      "|    time_elapsed         | 50          |\n",
      "|    total_timesteps      | 8192        |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.017152693 |\n",
      "|    clip_fraction        | 0.168       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -28.7       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.296      |\n",
      "|    n_updates            | 30          |\n",
      "|    policy_gradient_loss | -0.00671    |\n",
      "|    std                  | 1.02        |\n",
      "|    value_loss           | 0.00172     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.5         |\n",
      "|    total_reward         | -168        |\n",
      "|    total_reward_pct     | -0.0168     |\n",
      "|    total_trades         | 27060       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 162         |\n",
      "|    iterations           | 5           |\n",
      "|    time_elapsed         | 62          |\n",
      "|    total_timesteps      | 10240       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.014000677 |\n",
      "|    clip_fraction        | 0.25        |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -28.9       |\n",
      "|    explained_variance   | -5.73e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.312      |\n",
      "|    n_updates            | 40          |\n",
      "|    policy_gradient_loss | -0.0102     |\n",
      "|    std                  | 1.03        |\n",
      "|    value_loss           | 0.000715    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.57        |\n",
      "|    total_reward         | -193        |\n",
      "|    total_reward_pct     | -0.0193     |\n",
      "|    total_trades         | 27170       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 164         |\n",
      "|    iterations           | 6           |\n",
      "|    time_elapsed         | 74          |\n",
      "|    total_timesteps      | 12288       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.016415577 |\n",
      "|    clip_fraction        | 0.166       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29         |\n",
      "|    explained_variance   | -3.9e+11    |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.292      |\n",
      "|    n_updates            | 50          |\n",
      "|    policy_gradient_loss | -0.00755    |\n",
      "|    std                  | 1.04        |\n",
      "|    value_loss           | 0.000463    |\n",
      "-----------------------------------------\n",
      "day: 1531, episode: 10\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999814.85\n",
      "total_reward: -185.15\n",
      "total_cost: 3.61\n",
      "total_trades: 26973\n",
      "Sharpe: -0.491\n",
      "=================================\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.61        |\n",
      "|    total_reward         | -185        |\n",
      "|    total_reward_pct     | -0.0185     |\n",
      "|    total_trades         | 26973       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 164         |\n",
      "|    iterations           | 7           |\n",
      "|    time_elapsed         | 86          |\n",
      "|    total_timesteps      | 14336       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.010623859 |\n",
      "|    clip_fraction        | 0.133       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.1       |\n",
      "|    explained_variance   | -5.26e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.321      |\n",
      "|    n_updates            | 60          |\n",
      "|    policy_gradient_loss | -0.00725    |\n",
      "|    std                  | 1.04        |\n",
      "|    value_loss           | 0.000557    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.57        |\n",
      "|    total_reward         | -161        |\n",
      "|    total_reward_pct     | -0.0161     |\n",
      "|    total_trades         | 27019       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 164         |\n",
      "|    iterations           | 8           |\n",
      "|    time_elapsed         | 99          |\n",
      "|    total_timesteps      | 16384       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.014223068 |\n",
      "|    clip_fraction        | 0.19        |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.2       |\n",
      "|    explained_variance   | -7.96e+10   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.309      |\n",
      "|    n_updates            | 70          |\n",
      "|    policy_gradient_loss | -0.00855    |\n",
      "|    std                  | 1.04        |\n",
      "|    value_loss           | 0.00023     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.54        |\n",
      "|    total_reward         | -123        |\n",
      "|    total_reward_pct     | -0.0123     |\n",
      "|    total_trades         | 26865       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 165         |\n",
      "|    iterations           | 9           |\n",
      "|    time_elapsed         | 111         |\n",
      "|    total_timesteps      | 18432       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011727284 |\n",
      "|    clip_fraction        | 0.175       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.3       |\n",
      "|    explained_variance   | -4.85e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.311      |\n",
      "|    n_updates            | 80          |\n",
      "|    policy_gradient_loss | -0.00791    |\n",
      "|    std                  | 1.05        |\n",
      "|    value_loss           | 0.000137    |\n",
      "-----------------------------------------\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.57       |\n",
      "|    total_reward         | -134       |\n",
      "|    total_reward_pct     | -0.0134    |\n",
      "|    total_trades         | 26745      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 165        |\n",
      "|    iterations           | 10         |\n",
      "|    time_elapsed         | 124        |\n",
      "|    total_timesteps      | 20480      |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.02059851 |\n",
      "|    clip_fraction        | 0.214      |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -29.4      |\n",
      "|    explained_variance   | -6.25e+11  |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.282     |\n",
      "|    n_updates            | 90         |\n",
      "|    policy_gradient_loss | -0.0115    |\n",
      "|    std                  | 1.05       |\n",
      "|    value_loss           | 0.000185   |\n",
      "----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.51        |\n",
      "|    total_reward         | -110        |\n",
      "|    total_reward_pct     | -0.011      |\n",
      "|    total_trades         | 26736       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 165         |\n",
      "|    iterations           | 11          |\n",
      "|    time_elapsed         | 136         |\n",
      "|    total_timesteps      | 22528       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.008711362 |\n",
      "|    clip_fraction        | 0.145       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.4       |\n",
      "|    explained_variance   | -2.13e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.294      |\n",
      "|    n_updates            | 100         |\n",
      "|    policy_gradient_loss | -0.00719    |\n",
      "|    std                  | 1.06        |\n",
      "|    value_loss           | 6.51e-05    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.57        |\n",
      "|    total_reward         | -167        |\n",
      "|    total_reward_pct     | -0.0167     |\n",
      "|    total_trades         | 26713       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 165         |\n",
      "|    iterations           | 12          |\n",
      "|    time_elapsed         | 148         |\n",
      "|    total_timesteps      | 24576       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.010108855 |\n",
      "|    clip_fraction        | 0.109       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.5       |\n",
      "|    explained_variance   | -1.45e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.282      |\n",
      "|    n_updates            | 110         |\n",
      "|    policy_gradient_loss | -0.00649    |\n",
      "|    std                  | 1.06        |\n",
      "|    value_loss           | 4.56e-05    |\n",
      "-----------------------------------------\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.5        |\n",
      "|    total_reward         | -128       |\n",
      "|    total_reward_pct     | -0.0128    |\n",
      "|    total_trades         | 26621      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 165        |\n",
      "|    iterations           | 13         |\n",
      "|    time_elapsed         | 160        |\n",
      "|    total_timesteps      | 26624      |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.01720855 |\n",
      "|    clip_fraction        | 0.146      |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -29.6      |\n",
      "|    explained_variance   | -7.95e+11  |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.319     |\n",
      "|    n_updates            | 120        |\n",
      "|    policy_gradient_loss | -0.00817   |\n",
      "|    std                  | 1.06       |\n",
      "|    value_loss           | 5.62e-05   |\n",
      "----------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.51         |\n",
      "|    total_reward         | -113         |\n",
      "|    total_reward_pct     | -0.0113      |\n",
      "|    total_trades         | 26786        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 165          |\n",
      "|    iterations           | 14           |\n",
      "|    time_elapsed         | 173          |\n",
      "|    total_timesteps      | 28672        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0055312617 |\n",
      "|    clip_fraction        | 0.127        |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -29.6        |\n",
      "|    explained_variance   | 0.889        |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.306       |\n",
      "|    n_updates            | 130          |\n",
      "|    policy_gradient_loss | -0.00953     |\n",
      "|    std                  | 1.06         |\n",
      "|    value_loss           | 0.00176      |\n",
      "------------------------------------------\n",
      "day: 1531, episode: 20\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999884.44\n",
      "total_reward: -115.56\n",
      "total_cost: 3.49\n",
      "total_trades: 26643\n",
      "Sharpe: -0.385\n",
      "=================================\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.52         |\n",
      "|    total_reward         | -183         |\n",
      "|    total_reward_pct     | -0.0183      |\n",
      "|    total_trades         | 26733        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 165          |\n",
      "|    iterations           | 15           |\n",
      "|    time_elapsed         | 185          |\n",
      "|    total_timesteps      | 30720        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0086577665 |\n",
      "|    clip_fraction        | 0.16         |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -29.6        |\n",
      "|    explained_variance   | nan          |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.307       |\n",
      "|    n_updates            | 140          |\n",
      "|    policy_gradient_loss | -0.00984     |\n",
      "|    std                  | 1.07         |\n",
      "|    value_loss           | 8.6e-06      |\n",
      "------------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.35         |\n",
      "|    total_reward         | -116         |\n",
      "|    total_reward_pct     | -0.0116      |\n",
      "|    total_trades         | 26804        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 165          |\n",
      "|    iterations           | 16           |\n",
      "|    time_elapsed         | 197          |\n",
      "|    total_timesteps      | 32768        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0101423925 |\n",
      "|    clip_fraction        | 0.109        |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -29.7        |\n",
      "|    explained_variance   | -4.83e+11    |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.307       |\n",
      "|    n_updates            | 150          |\n",
      "|    policy_gradient_loss | -0.00833     |\n",
      "|    std                  | 1.07         |\n",
      "|    value_loss           | 7.7e-06      |\n",
      "------------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.44        |\n",
      "|    total_reward         | -88.9       |\n",
      "|    total_reward_pct     | -0.00889    |\n",
      "|    total_trades         | 26672       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 17          |\n",
      "|    time_elapsed         | 209         |\n",
      "|    total_timesteps      | 34816       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.010673854 |\n",
      "|    clip_fraction        | 0.158       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.7       |\n",
      "|    explained_variance   | -8.28e+10   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.324      |\n",
      "|    n_updates            | 160         |\n",
      "|    policy_gradient_loss | -0.0109     |\n",
      "|    std                  | 1.07        |\n",
      "|    value_loss           | 3.49e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.45        |\n",
      "|    total_reward         | -89.1       |\n",
      "|    total_reward_pct     | -0.00891    |\n",
      "|    total_trades         | 26937       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 18          |\n",
      "|    time_elapsed         | 221         |\n",
      "|    total_timesteps      | 36864       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011596454 |\n",
      "|    clip_fraction        | 0.178       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.8       |\n",
      "|    explained_variance   | -1.35e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.305      |\n",
      "|    n_updates            | 170         |\n",
      "|    policy_gradient_loss | -0.0116     |\n",
      "|    std                  | 1.08        |\n",
      "|    value_loss           | 2.51e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.42        |\n",
      "|    total_reward         | -85.3       |\n",
      "|    total_reward_pct     | -0.00853    |\n",
      "|    total_trades         | 26809       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 19          |\n",
      "|    time_elapsed         | 233         |\n",
      "|    total_timesteps      | 38912       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011890191 |\n",
      "|    clip_fraction        | 0.144       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.9       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.314      |\n",
      "|    n_updates            | 180         |\n",
      "|    policy_gradient_loss | -0.0114     |\n",
      "|    std                  | 1.08        |\n",
      "|    value_loss           | 2.99e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.49        |\n",
      "|    total_reward         | -67.4       |\n",
      "|    total_reward_pct     | -0.00674    |\n",
      "|    total_trades         | 26761       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 20          |\n",
      "|    time_elapsed         | 245         |\n",
      "|    total_timesteps      | 40960       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.007186763 |\n",
      "|    clip_fraction        | 0.128       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -29.9       |\n",
      "|    explained_variance   | 0.863       |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.314      |\n",
      "|    n_updates            | 190         |\n",
      "|    policy_gradient_loss | -0.0103     |\n",
      "|    std                  | 1.08        |\n",
      "|    value_loss           | 0.00299     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.24        |\n",
      "|    total_reward         | -76.2       |\n",
      "|    total_reward_pct     | -0.00762    |\n",
      "|    total_trades         | 26628       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 21          |\n",
      "|    time_elapsed         | 257         |\n",
      "|    total_timesteps      | 43008       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.008405123 |\n",
      "|    clip_fraction        | 0.172       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30         |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.299      |\n",
      "|    n_updates            | 200         |\n",
      "|    policy_gradient_loss | -0.0112     |\n",
      "|    std                  | 1.09        |\n",
      "|    value_loss           | 5.93e-06    |\n",
      "-----------------------------------------\n",
      "day: 1531, episode: 30\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999897.17\n",
      "total_reward: -102.83\n",
      "total_cost: 3.30\n",
      "total_trades: 26799\n",
      "Sharpe: -0.385\n",
      "=================================\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.3         |\n",
      "|    total_reward         | -103        |\n",
      "|    total_reward_pct     | -0.0103     |\n",
      "|    total_trades         | 26799       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 22          |\n",
      "|    time_elapsed         | 270         |\n",
      "|    total_timesteps      | 45056       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011229778 |\n",
      "|    clip_fraction        | 0.143       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.1       |\n",
      "|    explained_variance   | -3.7e+11    |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.313      |\n",
      "|    n_updates            | 210         |\n",
      "|    policy_gradient_loss | -0.0113     |\n",
      "|    std                  | 1.09        |\n",
      "|    value_loss           | 6.12e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.39        |\n",
      "|    total_reward         | -111        |\n",
      "|    total_reward_pct     | -0.0111     |\n",
      "|    total_trades         | 26703       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 23          |\n",
      "|    time_elapsed         | 282         |\n",
      "|    total_timesteps      | 47104       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.013620828 |\n",
      "|    clip_fraction        | 0.119       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.1       |\n",
      "|    explained_variance   | -1.42e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.316      |\n",
      "|    n_updates            | 220         |\n",
      "|    policy_gradient_loss | -0.00804    |\n",
      "|    std                  | 1.09        |\n",
      "|    value_loss           | 2.9e-06     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.38        |\n",
      "|    total_reward         | -120        |\n",
      "|    total_reward_pct     | -0.012      |\n",
      "|    total_trades         | 26616       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 24          |\n",
      "|    time_elapsed         | 294         |\n",
      "|    total_timesteps      | 49152       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.014872853 |\n",
      "|    clip_fraction        | 0.119       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.2       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.3        |\n",
      "|    n_updates            | 230         |\n",
      "|    policy_gradient_loss | -0.0142     |\n",
      "|    std                  | 1.1         |\n",
      "|    value_loss           | 2.36e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.4         |\n",
      "|    total_reward         | -115        |\n",
      "|    total_reward_pct     | -0.0115     |\n",
      "|    total_trades         | 26338       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 25          |\n",
      "|    time_elapsed         | 307         |\n",
      "|    total_timesteps      | 51200       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.013360227 |\n",
      "|    clip_fraction        | 0.169       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.2       |\n",
      "|    explained_variance   | -5.88e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.32       |\n",
      "|    n_updates            | 240         |\n",
      "|    policy_gradient_loss | -0.0036     |\n",
      "|    std                  | 1.1         |\n",
      "|    value_loss           | 2.58e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.38        |\n",
      "|    total_reward         | -81.4       |\n",
      "|    total_reward_pct     | -0.00814    |\n",
      "|    total_trades         | 26674       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 26          |\n",
      "|    time_elapsed         | 319         |\n",
      "|    total_timesteps      | 53248       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.010981428 |\n",
      "|    clip_fraction        | 0.13        |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.3       |\n",
      "|    explained_variance   | -2.92e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.32       |\n",
      "|    n_updates            | 250         |\n",
      "|    policy_gradient_loss | -0.00814    |\n",
      "|    std                  | 1.11        |\n",
      "|    value_loss           | 1.18e-06    |\n",
      "-----------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.3          |\n",
      "|    total_reward         | -101         |\n",
      "|    total_reward_pct     | -0.0101      |\n",
      "|    total_trades         | 26399        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 166          |\n",
      "|    iterations           | 27           |\n",
      "|    time_elapsed         | 332          |\n",
      "|    total_timesteps      | 55296        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0042601842 |\n",
      "|    clip_fraction        | 0.1          |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -30.4        |\n",
      "|    explained_variance   | -2.3e+11     |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.316       |\n",
      "|    n_updates            | 260          |\n",
      "|    policy_gradient_loss | -0.00786     |\n",
      "|    std                  | 1.11         |\n",
      "|    value_loss           | 9.47e-07     |\n",
      "------------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.49        |\n",
      "|    total_reward         | -113        |\n",
      "|    total_reward_pct     | -0.0113     |\n",
      "|    total_trades         | 26503       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 28          |\n",
      "|    time_elapsed         | 344         |\n",
      "|    total_timesteps      | 57344       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011701225 |\n",
      "|    clip_fraction        | 0.0771      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.4       |\n",
      "|    explained_variance   | -1.38e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.307      |\n",
      "|    n_updates            | 270         |\n",
      "|    policy_gradient_loss | -0.00691    |\n",
      "|    std                  | 1.11        |\n",
      "|    value_loss           | 1.38e-06    |\n",
      "-----------------------------------------\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.4        |\n",
      "|    total_reward         | -111       |\n",
      "|    total_reward_pct     | -0.0111    |\n",
      "|    total_trades         | 26516      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 166        |\n",
      "|    iterations           | 29         |\n",
      "|    time_elapsed         | 356        |\n",
      "|    total_timesteps      | 59392      |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.01345514 |\n",
      "|    clip_fraction        | 0.121      |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -30.5      |\n",
      "|    explained_variance   | nan        |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.299     |\n",
      "|    n_updates            | 280        |\n",
      "|    policy_gradient_loss | -0.00838   |\n",
      "|    std                  | 1.12       |\n",
      "|    value_loss           | 9.85e-07   |\n",
      "----------------------------------------\n",
      "day: 1531, episode: 40\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999895.23\n",
      "total_reward: -104.77\n",
      "total_cost: 3.36\n",
      "total_trades: 26380\n",
      "Sharpe: -0.372\n",
      "=================================\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.33        |\n",
      "|    total_reward         | -124        |\n",
      "|    total_reward_pct     | -0.0124     |\n",
      "|    total_trades         | 26127       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 30          |\n",
      "|    time_elapsed         | 368         |\n",
      "|    total_timesteps      | 61440       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.013006205 |\n",
      "|    clip_fraction        | 0.0719      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.6       |\n",
      "|    explained_variance   | -9.26e+11   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.308      |\n",
      "|    n_updates            | 290         |\n",
      "|    policy_gradient_loss | -0.00579    |\n",
      "|    std                  | 1.12        |\n",
      "|    value_loss           | 9.7e-07     |\n",
      "-----------------------------------------\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.29       |\n",
      "|    total_reward         | -87.9      |\n",
      "|    total_reward_pct     | -0.00879   |\n",
      "|    total_trades         | 26406      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 166        |\n",
      "|    iterations           | 31         |\n",
      "|    time_elapsed         | 380        |\n",
      "|    total_timesteps      | 63488      |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.01174724 |\n",
      "|    clip_fraction        | 0.117      |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -30.6      |\n",
      "|    explained_variance   | -5.89e+12  |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.316     |\n",
      "|    n_updates            | 300        |\n",
      "|    policy_gradient_loss | -0.00889   |\n",
      "|    std                  | 1.12       |\n",
      "|    value_loss           | 1.6e-06    |\n",
      "----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.32        |\n",
      "|    total_reward         | -109        |\n",
      "|    total_reward_pct     | -0.0109     |\n",
      "|    total_trades         | 26481       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 32          |\n",
      "|    time_elapsed         | 392         |\n",
      "|    total_timesteps      | 65536       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.009584131 |\n",
      "|    clip_fraction        | 0.0912      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.7       |\n",
      "|    explained_variance   | -1.62e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.319      |\n",
      "|    n_updates            | 310         |\n",
      "|    policy_gradient_loss | -0.00866    |\n",
      "|    std                  | 1.12        |\n",
      "|    value_loss           | 4.19e-07    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.43        |\n",
      "|    total_reward         | -119        |\n",
      "|    total_reward_pct     | -0.0119     |\n",
      "|    total_trades         | 26584       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 33          |\n",
      "|    time_elapsed         | 405         |\n",
      "|    total_timesteps      | 67584       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011994114 |\n",
      "|    clip_fraction        | 0.127       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.7       |\n",
      "|    explained_variance   | -3.47e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.328      |\n",
      "|    n_updates            | 320         |\n",
      "|    policy_gradient_loss | -0.00881    |\n",
      "|    std                  | 1.13        |\n",
      "|    value_loss           | 8.31e-07    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.4         |\n",
      "|    total_reward         | -138        |\n",
      "|    total_reward_pct     | -0.0138     |\n",
      "|    total_trades         | 26539       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 34          |\n",
      "|    time_elapsed         | 417         |\n",
      "|    total_timesteps      | 69632       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.015922684 |\n",
      "|    clip_fraction        | 0.0976      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.8       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.346      |\n",
      "|    n_updates            | 330         |\n",
      "|    policy_gradient_loss | -0.00794    |\n",
      "|    std                  | 1.13        |\n",
      "|    value_loss           | 1.14e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.43        |\n",
      "|    total_reward         | -98.1       |\n",
      "|    total_reward_pct     | -0.00981    |\n",
      "|    total_trades         | 26531       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 35          |\n",
      "|    time_elapsed         | 429         |\n",
      "|    total_timesteps      | 71680       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.007945072 |\n",
      "|    clip_fraction        | 0.101       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.9       |\n",
      "|    explained_variance   | -1.86e+13   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.295      |\n",
      "|    n_updates            | 340         |\n",
      "|    policy_gradient_loss | -0.0068     |\n",
      "|    std                  | 1.13        |\n",
      "|    value_loss           | 1.1e-06     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.51        |\n",
      "|    total_reward         | -112        |\n",
      "|    total_reward_pct     | -0.0112     |\n",
      "|    total_trades         | 26558       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 36          |\n",
      "|    time_elapsed         | 441         |\n",
      "|    total_timesteps      | 73728       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011464764 |\n",
      "|    clip_fraction        | 0.0761      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -30.9       |\n",
      "|    explained_variance   | -5.6e+13    |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.304      |\n",
      "|    n_updates            | 350         |\n",
      "|    policy_gradient_loss | -0.00659    |\n",
      "|    std                  | 1.14        |\n",
      "|    value_loss           | 1.18e-06    |\n",
      "-----------------------------------------\n",
      "day: 1531, episode: 50\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999885.16\n",
      "total_reward: -114.84\n",
      "total_cost: 3.54\n",
      "total_trades: 26507\n",
      "Sharpe: -0.358\n",
      "=================================\n",
      "----------------------------------------\n",
      "| environment/            |            |\n",
      "|    portfolio_value      | 1e+06      |\n",
      "|    total_cost           | 3.54       |\n",
      "|    total_reward         | -115       |\n",
      "|    total_reward_pct     | -0.0115    |\n",
      "|    total_trades         | 26507      |\n",
      "| time/                   |            |\n",
      "|    fps                  | 166        |\n",
      "|    iterations           | 37         |\n",
      "|    time_elapsed         | 454        |\n",
      "|    total_timesteps      | 75776      |\n",
      "| train/                  |            |\n",
      "|    approx_kl            | 0.00880802 |\n",
      "|    clip_fraction        | 0.0921     |\n",
      "|    clip_range           | 0.2        |\n",
      "|    entropy_loss         | -31        |\n",
      "|    explained_variance   | -7.06e+13  |\n",
      "|    learning_rate        | 0.00025    |\n",
      "|    loss                 | -0.316     |\n",
      "|    n_updates            | 360        |\n",
      "|    policy_gradient_loss | -0.00767   |\n",
      "|    std                  | 1.14       |\n",
      "|    value_loss           | 1.27e-06   |\n",
      "----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.47        |\n",
      "|    total_reward         | -99.3       |\n",
      "|    total_reward_pct     | -0.00993    |\n",
      "|    total_trades         | 26557       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 38          |\n",
      "|    time_elapsed         | 466         |\n",
      "|    total_timesteps      | 77824       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.015266656 |\n",
      "|    clip_fraction        | 0.145       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31         |\n",
      "|    explained_variance   | -5.21e+13   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.333      |\n",
      "|    n_updates            | 370         |\n",
      "|    policy_gradient_loss | -0.0118     |\n",
      "|    std                  | 1.14        |\n",
      "|    value_loss           | 8.85e-07    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.46        |\n",
      "|    total_reward         | -106        |\n",
      "|    total_reward_pct     | -0.0106     |\n",
      "|    total_trades         | 26653       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 166         |\n",
      "|    iterations           | 39          |\n",
      "|    time_elapsed         | 478         |\n",
      "|    total_timesteps      | 79872       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.008945227 |\n",
      "|    clip_fraction        | 0.115       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31         |\n",
      "|    explained_variance   | -3.12e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.307      |\n",
      "|    n_updates            | 380         |\n",
      "|    policy_gradient_loss | -0.0093     |\n",
      "|    std                  | 1.14        |\n",
      "|    value_loss           | 9.2e-07     |\n",
      "-----------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.51         |\n",
      "|    total_reward         | -118         |\n",
      "|    total_reward_pct     | -0.0118      |\n",
      "|    total_trades         | 26574        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 166          |\n",
      "|    iterations           | 40           |\n",
      "|    time_elapsed         | 490          |\n",
      "|    total_timesteps      | 81920        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0061367434 |\n",
      "|    clip_fraction        | 0.0783       |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -31          |\n",
      "|    explained_variance   | -1.53e+13    |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.296       |\n",
      "|    n_updates            | 390          |\n",
      "|    policy_gradient_loss | -0.00741     |\n",
      "|    std                  | 1.15         |\n",
      "|    value_loss           | 1.08e-06     |\n",
      "------------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.52        |\n",
      "|    total_reward         | -125        |\n",
      "|    total_reward_pct     | -0.0125     |\n",
      "|    total_trades         | 26695       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 41          |\n",
      "|    time_elapsed         | 502         |\n",
      "|    total_timesteps      | 83968       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.012089337 |\n",
      "|    clip_fraction        | 0.155       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.1       |\n",
      "|    explained_variance   | 0.278       |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.325      |\n",
      "|    n_updates            | 400         |\n",
      "|    policy_gradient_loss | -0.00648    |\n",
      "|    std                  | 1.15        |\n",
      "|    value_loss           | 0.000201    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.53        |\n",
      "|    total_reward         | -78.1       |\n",
      "|    total_reward_pct     | -0.00781    |\n",
      "|    total_trades         | 26795       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 42          |\n",
      "|    time_elapsed         | 514         |\n",
      "|    total_timesteps      | 86016       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.009242485 |\n",
      "|    clip_fraction        | 0.0884      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.1       |\n",
      "|    explained_variance   | -1.36e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.313      |\n",
      "|    n_updates            | 410         |\n",
      "|    policy_gradient_loss | -0.00681    |\n",
      "|    std                  | 1.15        |\n",
      "|    value_loss           | 1.41e-06    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.39        |\n",
      "|    total_reward         | -124        |\n",
      "|    total_reward_pct     | -0.0124     |\n",
      "|    total_trades         | 26390       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 43          |\n",
      "|    time_elapsed         | 527         |\n",
      "|    total_timesteps      | 88064       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.014945236 |\n",
      "|    clip_fraction        | 0.12        |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.1       |\n",
      "|    explained_variance   | -3.72e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.322      |\n",
      "|    n_updates            | 420         |\n",
      "|    policy_gradient_loss | -0.00791    |\n",
      "|    std                  | 1.15        |\n",
      "|    value_loss           | 9.62e-07    |\n",
      "-----------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.48         |\n",
      "|    total_reward         | -105         |\n",
      "|    total_reward_pct     | -0.0105      |\n",
      "|    total_trades         | 26527        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 167          |\n",
      "|    iterations           | 44           |\n",
      "|    time_elapsed         | 539          |\n",
      "|    total_timesteps      | 90112        |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0064164586 |\n",
      "|    clip_fraction        | 0.0946       |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -31.2        |\n",
      "|    explained_variance   | -1.65e+12    |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.328       |\n",
      "|    n_updates            | 430          |\n",
      "|    policy_gradient_loss | -0.00623     |\n",
      "|    std                  | 1.16         |\n",
      "|    value_loss           | 8.78e-07     |\n",
      "------------------------------------------\n",
      "day: 1531, episode: 60\n",
      "begin_total_asset: 1000000.00\n",
      "end_total_asset: 999896.24\n",
      "total_reward: -103.76\n",
      "total_cost: 3.47\n",
      "total_trades: 26637\n",
      "Sharpe: -0.373\n",
      "=================================\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.34        |\n",
      "|    total_reward         | -109        |\n",
      "|    total_reward_pct     | -0.0109     |\n",
      "|    total_trades         | 26444       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 45          |\n",
      "|    time_elapsed         | 551         |\n",
      "|    total_timesteps      | 92160       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.011250228 |\n",
      "|    clip_fraction        | 0.0952      |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.3       |\n",
      "|    explained_variance   | -3.97e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.319      |\n",
      "|    n_updates            | 440         |\n",
      "|    policy_gradient_loss | -0.00673    |\n",
      "|    std                  | 1.16        |\n",
      "|    value_loss           | 9.7e-07     |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.49        |\n",
      "|    total_reward         | -134        |\n",
      "|    total_reward_pct     | -0.0134     |\n",
      "|    total_trades         | 26454       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 46          |\n",
      "|    time_elapsed         | 563         |\n",
      "|    total_timesteps      | 94208       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.007227339 |\n",
      "|    clip_fraction        | 0.104       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.3       |\n",
      "|    explained_variance   | -1.26e+13   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.317      |\n",
      "|    n_updates            | 450         |\n",
      "|    policy_gradient_loss | -0.0085     |\n",
      "|    std                  | 1.16        |\n",
      "|    value_loss           | 7.88e-07    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.46        |\n",
      "|    total_reward         | -106        |\n",
      "|    total_reward_pct     | -0.0106     |\n",
      "|    total_trades         | 26403       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 47          |\n",
      "|    time_elapsed         | 575         |\n",
      "|    total_timesteps      | 96256       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.008626322 |\n",
      "|    clip_fraction        | 0.122       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.3       |\n",
      "|    explained_variance   | -3.74e+12   |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.339      |\n",
      "|    n_updates            | 460         |\n",
      "|    policy_gradient_loss | -0.00907    |\n",
      "|    std                  | 1.16        |\n",
      "|    value_loss           | 9.11e-07    |\n",
      "-----------------------------------------\n",
      "-----------------------------------------\n",
      "| environment/            |             |\n",
      "|    portfolio_value      | 1e+06       |\n",
      "|    total_cost           | 3.56        |\n",
      "|    total_reward         | -139        |\n",
      "|    total_reward_pct     | -0.0139     |\n",
      "|    total_trades         | 26427       |\n",
      "| time/                   |             |\n",
      "|    fps                  | 167         |\n",
      "|    iterations           | 48          |\n",
      "|    time_elapsed         | 588         |\n",
      "|    total_timesteps      | 98304       |\n",
      "| train/                  |             |\n",
      "|    approx_kl            | 0.010206931 |\n",
      "|    clip_fraction        | 0.115       |\n",
      "|    clip_range           | 0.2         |\n",
      "|    entropy_loss         | -31.4       |\n",
      "|    explained_variance   | nan         |\n",
      "|    learning_rate        | 0.00025     |\n",
      "|    loss                 | -0.317      |\n",
      "|    n_updates            | 470         |\n",
      "|    policy_gradient_loss | -0.00823    |\n",
      "|    std                  | 1.16        |\n",
      "|    value_loss           | 1.03e-06    |\n",
      "-----------------------------------------\n",
      "------------------------------------------\n",
      "| environment/            |              |\n",
      "|    portfolio_value      | 1e+06        |\n",
      "|    total_cost           | 3.48         |\n",
      "|    total_reward         | -130         |\n",
      "|    total_reward_pct     | -0.013       |\n",
      "|    total_trades         | 26243        |\n",
      "| time/                   |              |\n",
      "|    fps                  | 167          |\n",
      "|    iterations           | 49           |\n",
      "|    time_elapsed         | 600          |\n",
      "|    total_timesteps      | 100352       |\n",
      "| train/                  |              |\n",
      "|    approx_kl            | 0.0133235445 |\n",
      "|    clip_fraction        | 0.127        |\n",
      "|    clip_range           | 0.2          |\n",
      "|    entropy_loss         | -31.4        |\n",
      "|    explained_variance   | -6.38e+13    |\n",
      "|    learning_rate        | 0.00025      |\n",
      "|    loss                 | -0.337       |\n",
      "|    n_updates            | 480          |\n",
      "|    policy_gradient_loss | -0.00896     |\n",
      "|    std                  | 1.17         |\n",
      "|    value_loss           | 1.14e-06     |\n",
      "------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "trained_ppo = agent.train_model(model=model_ppo, \n",
    "                             tb_log_name='ppo',\n",
    "                             total_timesteps=100000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "QjrKBLwEJ3Ip",
    "outputId": "29d79494-45a0-46f5-bddd-4bd9bfaf53c9"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hit end!\n"
     ]
    }
   ],
   "source": [
    "e_trade_gym = StockTradingEnv(df = trade, **env_kwargs)\n",
    "# env_trade, obs_trade = e_trade_gym.get_sb_env()\n",
    "\n",
    "df_account_value, df_actions = DRLAgent.DRL_prediction(\n",
    "    model=model_ppo, \n",
    "    environment = e_trade_gym)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "gtl4aN1_KH62",
    "outputId": "c8fc3283-2fa1-4e2f-c0dc-ba7416586051"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(658, 2)"
      ]
     },
     "execution_count": 123,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_account_value.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 206
    },
    "id": "aQ8dU9GfKJ9q",
    "outputId": "95cb8668-7ad8-4f83-9ace-7a1f6df8e8e9"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>account_value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-10-25 12:00:00</td>\n",
       "      <td>1.000000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-10-25 16:00:00</td>\n",
       "      <td>1.000000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-10-25 20:00:00</td>\n",
       "      <td>1.000000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-10-26 00:00:00</td>\n",
       "      <td>1.000000e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-10-26 04:00:00</td>\n",
       "      <td>1.000000e+06</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  date  account_value\n",
       "0  2020-10-25 12:00:00   1.000000e+06\n",
       "1  2020-10-25 16:00:00   1.000000e+06\n",
       "2  2020-10-25 20:00:00   1.000000e+06\n",
       "3  2020-10-26 00:00:00   1.000000e+06\n",
       "4  2020-10-26 04:00:00   1.000000e+06"
      ]
     },
     "execution_count": 124,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_account_value.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 226
    },
    "id": "W5GysFd_KNCi",
    "outputId": "68ba8d48-7115-4ed3-90c4-493437e39ec8"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ANKR_BNB</th>\n",
       "      <th>BTT_BNB</th>\n",
       "      <th>CELR_BNB</th>\n",
       "      <th>CHZ_BNB</th>\n",
       "      <th>COS_BNB</th>\n",
       "      <th>DGB_BNB</th>\n",
       "      <th>FET_BNB</th>\n",
       "      <th>HOT_BNB</th>\n",
       "      <th>IOST_BNB</th>\n",
       "      <th>IQ_BNB</th>\n",
       "      <th>JST_BNB</th>\n",
       "      <th>MBL_BNB</th>\n",
       "      <th>MFT_BNB</th>\n",
       "      <th>MITH_BNB</th>\n",
       "      <th>OGN_BNB</th>\n",
       "      <th>ONE_BNB</th>\n",
       "      <th>RVN_BNB</th>\n",
       "      <th>WIN_BNB</th>\n",
       "      <th>XLM_BNB</th>\n",
       "      <th>XRP_BNB</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>37</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>73</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>94</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>60</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-60</td>\n",
       "      <td>0</td>\n",
       "      <td>26</td>\n",
       "      <td>0</td>\n",
       "      <td>-100</td>\n",
       "      <td>0</td>\n",
       "      <td>85</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>87</td>\n",
       "      <td>-10</td>\n",
       "      <td>0</td>\n",
       "      <td>83</td>\n",
       "      <td>-94</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>24</td>\n",
       "      <td>-27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-40</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>100</td>\n",
       "      <td>-70</td>\n",
       "      <td>100</td>\n",
       "      <td>57</td>\n",
       "      <td>49</td>\n",
       "      <td>39</td>\n",
       "      <td>42</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>27</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>15</td>\n",
       "      <td>100</td>\n",
       "      <td>-50</td>\n",
       "      <td>32</td>\n",
       "      <td>51</td>\n",
       "      <td>100</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>-100</td>\n",
       "      <td>90</td>\n",
       "      <td>-51</td>\n",
       "      <td>41</td>\n",
       "      <td>-100</td>\n",
       "      <td>-16</td>\n",
       "      <td>-42</td>\n",
       "      <td>0</td>\n",
       "      <td>18</td>\n",
       "      <td>-100</td>\n",
       "      <td>-49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>-6</td>\n",
       "      <td>-76</td>\n",
       "      <td>-7</td>\n",
       "      <td>100</td>\n",
       "      <td>-100</td>\n",
       "      <td>60</td>\n",
       "      <td>23</td>\n",
       "      <td>-100</td>\n",
       "      <td>88</td>\n",
       "      <td>85</td>\n",
       "      <td>-49</td>\n",
       "      <td>-53</td>\n",
       "      <td>100</td>\n",
       "      <td>-6</td>\n",
       "      <td>0</td>\n",
       "      <td>16</td>\n",
       "      <td>100</td>\n",
       "      <td>45</td>\n",
       "      <td>-14</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ANKR_BNB  BTT_BNB  CELR_BNB  CHZ_BNB  ...  RVN_BNB  WIN_BNB  XLM_BNB  XRP_BNB\n",
       "0       100        0         0        0  ...        0        0       60      100\n",
       "1       -60        0        26        0  ...        0        0       24      -27\n",
       "2       -40        0       100        0  ...        0        0       27      100\n",
       "3        15      100       -50       32  ...        0       18     -100      -49\n",
       "4         0       -6       -76       -7  ...       16      100       45      -14\n",
       "\n",
       "[5 rows x 20 columns]"
      ]
     },
     "execution_count": 125,
     "metadata": {
      "tags": []
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_actions.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "BlL6jdA8KPMj",
    "outputId": "b2eb1309-fc7a-4700-8366-03a5814dcd8d"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "==============Get Backtest Results===========\n",
      "Annual return         -0.000037\n",
      "Cumulative returns    -0.000096\n",
      "Annual volatility      0.000062\n",
      "Sharpe ratio          -0.590158\n",
      "Calmar ratio          -0.221633\n",
      "Stability              0.501955\n",
      "Max drawdown          -0.000165\n",
      "Omega ratio            0.860416\n",
      "Sortino ratio         -0.757088\n",
      "Skew                        NaN\n",
      "Kurtosis                    NaN\n",
      "Tail ratio             0.956235\n",
      "Daily value at risk   -0.000008\n",
      "dtype: float64\n"
     ]
    }
   ],
   "source": [
    "print(\"==============Get Backtest Results===========\")\n",
    "now = datetime.datetime.now().strftime('%Y%m%d-%Hh%M')\n",
    "\n",
    "perf_stats_all = backtest_stats(account_value=df_account_value)\n",
    "perf_stats_all = pd.DataFrame(perf_stats_all)\n",
    "# perf_stats_all.to_csv(\"./\"+config.RESULTS_DIR+\"/perf_stats_all_\"+now+'.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "wZMIq0bgF7TO"
   },
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "collapsed_sections": [],
   "name": "FINRL FREQ MODEL",
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
